@@ -36,25 +36,30 @@ import (
36
36
)
37
37
38
38
var (
39
- project = flag .String ("project" , "" , "Project to run tests in" )
40
- serviceAccount = flag .String ("service-account" , "" , "Service account to bring up instance with" )
41
- vmNamePrefix = flag .String ("vm-name-prefix" , "gce-pd-csi-e2e" , "VM name prefix" )
42
- architecture = flag .String ("arch" , "amd64" , "Architecture pd csi driver build on" )
43
- minCpuPlatform = flag .String ("min-cpu-platform" , "AMD Milan" , "Minimum CPU architecture" )
44
- zones = flag .String ("zones" , "us-east4-a,us-east4-c" , "Zones to run tests in. If there are multiple zones, separate each by comma" )
45
- machineType = flag .String ("machine-type" , "n2d-standard-2" , "Type of machine to provision instance on" )
39
+ project = flag .String ("project" , "" , "Project to run tests in" )
40
+ serviceAccount = flag .String ("service-account" , "" , "Service account to bring up instance with" )
41
+ vmNamePrefix = flag .String ("vm-name-prefix" , "gce-pd-csi-e2e" , "VM name prefix" )
42
+ architecture = flag .String ("arch" , "amd64" , "Architecture pd csi driver build on" )
43
+ minCpuPlatform = flag .String ("min-cpu-platform" , "rome" , "Minimum CPU architecture" )
44
+ mwMinCpuPlatform = flag .String ("min-cpu-platform-mw" , "sapphirerapids" , "Minimum CPU architecture for multiwriter tests" )
45
+ zones = flag .String ("zones" , "us-east4-a,us-east4-c" , "Zones to run tests in. If there are multiple zones, separate each by comma" )
46
+ machineType = flag .String ("machine-type" , "n2d-standard-4" , "Type of machine to provision instance on" )
47
+ // Multi-writer is only supported on M3, C3, and N4
48
+ // https://cloud.google.com/compute/docs/disks/sharing-disks-between-vms#hd-multi-writer
49
+ mwMachineType = flag .String ("mw-machine-type" , "c3-standard-4" , "Type of machine to provision instance for multiwriter tests" )
46
50
imageURL = flag .String ("image-url" , "projects/ubuntu-os-cloud/global/images/family/ubuntu-minimal-2404-lts-amd64" , "OS image url to get image from" )
47
51
runInProw = flag .Bool ("run-in-prow" , false , "If true, use a Boskos loaned project and special CI service accounts and ssh keys" )
48
52
deleteInstances = flag .Bool ("delete-instances" , false , "Delete the instances after tests run" )
49
53
cloudtopHost = flag .Bool ("cloudtop-host" , false , "The local host is cloudtop, a kind of googler machine with special requirements to access GCP" )
50
54
extraDriverFlags = flag .String ("extra-driver-flags" , "" , "Extra flags to pass to the driver" )
51
55
enableConfidentialCompute = flag .Bool ("enable-confidential-compute" , false , "Create VMs with confidential compute mode. This uses NVMe devices" )
52
56
53
- testContexts = []* remote.TestContext {}
54
- computeService * compute.Service
55
- computeAlphaService * computealpha.Service
56
- computeBetaService * computebeta.Service
57
- kmsClient * cloudkms.KeyManagementClient
57
+ testContexts = []* remote.TestContext {}
58
+ multiWriterTestContexts = []* remote.TestContext {}
59
+ computeService * compute.Service
60
+ computeAlphaService * computealpha.Service
61
+ computeBetaService * computebeta.Service
62
+ kmsClient * cloudkms.KeyManagementClient
58
63
)
59
64
60
65
func init () {
@@ -70,7 +75,9 @@ func TestE2E(t *testing.T) {
70
75
var _ = BeforeSuite (func () {
71
76
var err error
72
77
tcc := make (chan * remote.TestContext )
78
+ mwTcc := make (chan * remote.TestContext )
73
79
defer close (tcc )
80
+ defer close (mwTcc )
74
81
75
82
zones := strings .Split (* zones , "," )
76
83
@@ -101,13 +108,16 @@ var _ = BeforeSuite(func() {
101
108
for _ , zone := range zones {
102
109
go func (curZone string ) {
103
110
defer GinkgoRecover ()
104
- tcc <- NewTestContext (curZone )
111
+ tcc <- NewTestContext (curZone , * machineType , * minCpuPlatform )
112
+ mwTcc <- NewTestContext (curZone , * mwMachineType , * mwMinCpuPlatform )
105
113
}(zone )
106
114
}
107
115
108
116
for i := 0 ; i < len (zones ); i ++ {
109
117
tc := <- tcc
110
118
testContexts = append (testContexts , tc )
119
+ mwTc := <- mwTcc
120
+ multiWriterTestContexts = append (multiWriterTestContexts , mwTc )
111
121
klog .Infof ("Added TestContext for node %s" , tc .Instance .GetName ())
112
122
}
113
123
})
@@ -120,6 +130,13 @@ var _ = AfterSuite(func() {
120
130
tc .Instance .DeleteInstance ()
121
131
}
122
132
}
133
+ for _ , mwTc := range multiWriterTestContexts {
134
+ err := remote .TeardownDriverAndClient (mwTc )
135
+ Expect (err ).To (BeNil (), "Multiwriter Teardown Driver and Client failed with error" )
136
+ if * deleteInstances {
137
+ mwTc .Instance .DeleteInstance ()
138
+ }
139
+ }
123
140
})
124
141
125
142
func notEmpty (v string ) bool {
@@ -133,17 +150,17 @@ func getDriverConfig() testutils.DriverConfig {
133
150
}
134
151
}
135
152
136
- func NewTestContext (zone string ) * remote.TestContext {
137
- nodeID := fmt .Sprintf ("%s-%s" , * vmNamePrefix , zone )
153
+ func NewTestContext (zone string , machineType string , minCpuPlatform string ) * remote.TestContext {
154
+ nodeID := fmt .Sprintf ("%s-%s-%s " , * vmNamePrefix , zone , machineType )
138
155
klog .Infof ("Setting up node %s" , nodeID )
139
156
140
157
instanceConfig := remote.InstanceConfig {
141
158
Project : * project ,
142
159
Architecture : * architecture ,
143
- MinCpuPlatform : * minCpuPlatform ,
160
+ MinCpuPlatform : minCpuPlatform ,
144
161
Zone : zone ,
145
162
Name : nodeID ,
146
- MachineType : * machineType ,
163
+ MachineType : machineType ,
147
164
ServiceAccount : * serviceAccount ,
148
165
ImageURL : * imageURL ,
149
166
CloudtopHost : * cloudtopHost ,
@@ -185,3 +202,8 @@ func getRandomTestContext() *remote.TestContext {
185
202
rn := rand .Intn (len (testContexts ))
186
203
return testContexts [rn ]
187
204
}
205
+ func getRandomMwTestContext () * remote.TestContext {
206
+ Expect (multiWriterTestContexts ).ToNot (BeEmpty ())
207
+ rn := rand .Intn (len (multiWriterTestContexts ))
208
+ return multiWriterTestContexts [rn ]
209
+ }
0 commit comments