@@ -81,8 +81,6 @@ var _ = BeforeSuite(func() {
81
81
defer close (hdtcc )
82
82
83
83
zones := strings .Split (* zones , "," )
84
- // Create 2 instances for each zone as we need 2 instances each zone for certain test cases
85
-
86
84
rand .Seed (time .Now ().UnixNano ())
87
85
88
86
computeService , err = remote .GetComputeClient ()
@@ -109,15 +107,39 @@ var _ = BeforeSuite(func() {
109
107
110
108
numberOfInstancesPerZone := 2
111
109
110
+ // setupContext := func(zone string) {
111
+ // // Create 2 instances for each zone as we need 2 instances each zone for certain test cases
112
+ // for j := 0; j < numberOfInstancesPerZone; j++ {
113
+ // go func(curZone string, randInt int) {
114
+ // defer GinkgoRecover()
115
+ // tcc <- NewDefaultTestContext(curZone, strconv.Itoa(randInt))
116
+ // }(zone, j)
117
+ // }
118
+ // go func(curZone string) {
119
+ // defer GinkgoRecover()
120
+ // hdtcc <- NewTestContext(curZone, *hdMinCpuPlatform, *hdMachineType, "0")
121
+ // }(zone)
122
+ // }
123
+
124
+ // for _, zone := range zones {
125
+ // setupContext(zone)
126
+ // }
127
+
128
+ // for i := 0; i < len(zones)*numberOfInstancesPerZone; i++ {
129
+ // tc := <-tcc
130
+ // testContexts = append(testContexts, tc)
131
+ // klog.Infof("Added TestContext for node %s", tc.Instance.GetName())
132
+ // }
133
+ // for i := 0; i < len(zones); i++ {
134
+ // tc := <-hdtcc
135
+ // hyperdiskTestContexts = append(hyperdiskTestContexts, tc)
136
+ // klog.Infof("Added TestContext for node %s", tc.Instance.GetName())
137
+ // }
112
138
setupContext := func (zones []string , randInt int ) {
113
139
for _ , zone := range zones {
114
140
go func (curZone string ) {
115
141
defer GinkgoRecover ()
116
- tcc <- NewDefaultTestContext (curZone , strconv .Itoa (randInt ))
117
- }(zone )
118
- go func (curZone string ) {
119
- defer GinkgoRecover ()
120
- hdtcc <- NewTestContext (curZone , * hdMinCpuPlatform , * hdMachineType , strconv .Itoa (randInt ))
142
+ tcc <- NewTestContext (curZone , strconv .Itoa (randInt ))
121
143
}(zone )
122
144
}
123
145
}
@@ -129,12 +151,10 @@ var _ = BeforeSuite(func() {
129
151
tc := <- tcc
130
152
testContexts = append (testContexts , tc )
131
153
klog .Infof ("Added TestContext for node %s" , tc .Instance .GetName ())
132
- tc = <- hdtcc
133
- hyperdiskTestContexts = append (hyperdiskTestContexts , tc )
134
- klog .Infof ("Added TestContext for node %s" , tc .Instance .GetName ())
135
154
}
136
155
})
137
156
157
+
138
158
var _ = AfterSuite (func () {
139
159
for _ , tc := range testContexts {
140
160
err := remote .TeardownDriverAndClient (tc )
@@ -156,21 +176,83 @@ func getDriverConfig() testutils.DriverConfig {
156
176
}
157
177
}
158
178
159
- func NewDefaultTestContext (zone string , instanceNumber string ) * remote.TestContext {
160
- return NewTestContext (zone , * minCpuPlatform , * machineType , instanceNumber )
161
- }
162
-
163
- func NewTestContext (zone , minCpuPlatform , machineType string , instanceNumber string ) * remote.TestContext {
164
- nodeID := fmt .Sprintf ("%s-%s-%s-%s" , * vmNamePrefix , zone , machineType , instanceNumber )
179
+ // func NewDefaultTestContext(zone string, instanceNumber string) *remote.TestContext {
180
+ // return NewTestContext(zone, *minCpuPlatform, *machineType, instanceNumber)
181
+ // }
182
+
183
+ // func NewTestContext(zone, minCpuPlatform, machineType string, instanceNumber string) *remote.TestContext {
184
+ // nodeID := fmt.Sprintf("%s-%s-%s-%s", *vmNamePrefix, zone, machineType, instanceNumber)
185
+ // klog.Infof("Setting up node %s", nodeID)
186
+
187
+ // instanceConfig := remote.InstanceConfig{
188
+ // Project: *project,
189
+ // Architecture: *architecture,
190
+ // MinCpuPlatform: minCpuPlatform,
191
+ // Zone: zone,
192
+ // Name: nodeID,
193
+ // MachineType: machineType,
194
+ // ServiceAccount: *serviceAccount,
195
+ // ImageURL: *imageURL,
196
+ // CloudtopHost: *cloudtopHost,
197
+ // EnableConfidentialCompute: *enableConfidentialCompute,
198
+ // ComputeService: computeService,
199
+ // LocalSSDCount: localSSDCount,
200
+ // }
201
+
202
+ // if machineType == *hdMachineType {
203
+ // // Machine type is defaulted to c3-standard-2 which doesn't support LSSD and we don't need LSSD for HdHA test context
204
+ // instanceConfig.LocalSSDCount = 0
205
+ // }
206
+ // i, err := remote.SetupInstance(instanceConfig)
207
+ // if err != nil {
208
+ // klog.Fatalf("Failed to setup instance %v: %v", nodeID, err)
209
+ // }
210
+
211
+ // err = testutils.MkdirAll(i, "/lib/udev_containerized")
212
+ // if err != nil {
213
+ // klog.Fatalf("Failed to make scsi_id containerized directory: %v", err)
214
+ // }
215
+
216
+ // err = testutils.CopyFile(i, "/lib/udev/scsi_id", "/lib/udev_containerized/scsi_id")
217
+ // if err != nil {
218
+ // klog.Fatalf("Failed to copy scsi_id to containerized directory: %v", err)
219
+ // }
220
+
221
+ // err = testutils.CopyFile(i, "/lib/udev/google_nvme_id", "/lib/udev_containerized/google_nvme_id")
222
+ // if err != nil {
223
+ // klog.Fatalf("Failed to copy google_nvme_id to containerized directory: %v", err)
224
+ // }
225
+ // pkgs := []string{"lvm2", "mdadm", "grep", "coreutils"}
226
+ // err = testutils.InstallDependencies(i, pkgs)
227
+ // if err != nil {
228
+ // klog.Fatalf("Failed to install dependency package on node %v: error : %v", i.GetNodeID(), err)
229
+ // }
230
+
231
+ // err = testutils.SetupDataCachingConfig(i)
232
+ // if err != nil {
233
+ // klog.Fatalf("Failed to setup data cache required config error %v", err)
234
+ // }
235
+ // klog.Infof("Creating new driver and client for node %s", i.GetName())
236
+ // tc, err := testutils.GCEClientAndDriverSetup(i, getDriverConfig())
237
+ // if err != nil {
238
+ // klog.Fatalf("Failed to set up TestContext for instance %v: %v", i.GetName(), err)
239
+ // }
240
+
241
+ // klog.Infof("Finished creating TestContext for node %s", tc.Instance.GetName())
242
+ // return tc
243
+ // }
244
+
245
+ func NewTestContext (zone string , instanceNumber string ) * remote.TestContext {
246
+ nodeID := fmt .Sprintf ("%s-%s-%s" , * vmNamePrefix , zone , instanceNumber )
165
247
klog .Infof ("Setting up node %s" , nodeID )
166
248
167
249
instanceConfig := remote.InstanceConfig {
168
250
Project : * project ,
169
251
Architecture : * architecture ,
170
- MinCpuPlatform : minCpuPlatform ,
252
+ MinCpuPlatform : * minCpuPlatform ,
171
253
Zone : zone ,
172
254
Name : nodeID ,
173
- MachineType : machineType ,
255
+ MachineType : * machineType ,
174
256
ServiceAccount : * serviceAccount ,
175
257
ImageURL : * imageURL ,
176
258
CloudtopHost : * cloudtopHost ,
@@ -200,12 +282,12 @@ func NewTestContext(zone, minCpuPlatform, machineType string, instanceNumber str
200
282
pkgs := []string {"lvm2" , "mdadm" , "grep" , "coreutils" }
201
283
err = testutils .InstallDependencies (i , pkgs )
202
284
if err != nil {
203
- klog .Fatalf ("Failed to install dependency package on node %v: error : %v" , i .GetNodeID (), err )
285
+ klog .Errorf ("Failed to install dependency package on node %v: error : %v" , i .GetNodeID (), err )
204
286
}
205
287
206
288
err = testutils .SetupDataCachingConfig (i )
207
289
if err != nil {
208
- klog .Fatalf ("Failed to setup data cache required config error %v" , err )
290
+ klog .Errorf ("Failed to setup data cache required config error %v" , err )
209
291
}
210
292
klog .Infof ("Creating new driver and client for node %s" , i .GetName ())
211
293
tc , err := testutils .GCEClientAndDriverSetup (i , getDriverConfig ())
0 commit comments