forked from ohsu-comp-bio/funnel
/
Wrapper_helpers.go
43 lines (40 loc) · 1.12 KB
/
Wrapper_helpers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package mocks
import "google.golang.org/api/compute/v1"
// SetupMockMachineTypes is a helper to set up the wrapper mock to return
// the a common machine type list from Wrapper.ListMachineTypes()
func (wpr *Wrapper) SetupMockMachineTypes() {
wpr.On("ListMachineTypes", "test-proj", "test-zone").Return(&compute.MachineTypeList{
Items: []*compute.MachineType{
{
Name: "test-mt",
GuestCpus: 3,
MemoryMb: 1024,
},
},
}, nil)
}
// SetupMockInstanceTemplates is a helper which helps set up the wrapper mock
// to return a common instance template list.
func (wpr *Wrapper) SetupMockInstanceTemplates() {
wpr.On("ListInstanceTemplates", "test-proj").Return(&compute.InstanceTemplateList{
Items: []*compute.InstanceTemplate{
{
Name: "test-tpl",
Properties: &compute.InstanceProperties{
MachineType: "test-mt",
Disks: []*compute.AttachedDisk{
{
InitializeParams: &compute.AttachedDiskInitializeParams{
DiskSizeGb: 100,
},
},
},
Metadata: &compute.Metadata{},
Tags: &compute.Tags{
Items: []string{"funnel"},
},
},
},
},
}, nil)
}