@@ -21,6 +21,7 @@ import (
21
21
"math/rand"
22
22
"strconv"
23
23
"strings"
24
+ "sync"
24
25
"testing"
25
26
"time"
26
27
@@ -72,11 +73,10 @@ func TestE2E(t *testing.T) {
72
73
73
74
var _ = BeforeSuite (func () {
74
75
var err error
75
- tcc := make (chan * remote.TestContext )
76
- defer close (tcc )
77
-
76
+ numberOfInstancesPerZone := 2
78
77
zones := strings .Split (* zones , "," )
79
- // Create 2 instances for each zone as we need 2 instances each zone for certain test cases
78
+ tcc := make (chan * remote.TestContext , len (zones )* numberOfInstancesPerZone )
79
+ defer close (tcc )
80
80
81
81
rand .Seed (time .Now ().UnixNano ())
82
82
@@ -102,18 +102,21 @@ var _ = BeforeSuite(func() {
102
102
103
103
klog .Infof ("Running in project %v with service account %v" , * project , * serviceAccount )
104
104
105
- numberOfInstancesPerZone := 2
106
-
107
- setupContext := func (zones []string , randInt int ) {
108
- for _ , zone := range zones {
109
- go func (curZone string ) {
105
+ setupContext := func (zone string ) {
106
+ var wg sync.WaitGroup
107
+ // Create 2 instances for each zone as we need 2 instances each zone for certain test cases
108
+ for j := 0 ; j < numberOfInstancesPerZone ; j ++ {
109
+ wg .Add (1 )
110
+ go func (curZone string , randInt int ) {
110
111
defer GinkgoRecover ()
112
+ defer wg .Done ()
111
113
tcc <- NewDefaultTestContext (curZone , strconv .Itoa (randInt ))
112
- }(zone )
114
+ }(zone , j )
113
115
}
114
116
}
115
- for j := 0 ; j < numberOfInstancesPerZone ; j ++ {
116
- setupContext (zones , j )
117
+
118
+ for _ , zone := range zones {
119
+ setupContext (zone )
117
120
}
118
121
119
122
for i := 0 ; i < len (zones )* numberOfInstancesPerZone ; i ++ {
@@ -166,6 +169,11 @@ func NewTestContext(zone, minCpuPlatform, machineType string, instanceNumber str
166
169
ComputeService : computeService ,
167
170
LocalSSDCount : localSSDCount ,
168
171
}
172
+
173
+ if machineType == * hdMachineType {
174
+ // Machine type is defaulted to c3-standard-2 which doesn't support LSSD and we don't need LSSD for HdHA test context
175
+ instanceConfig .LocalSSDCount = 0
176
+ }
169
177
i , err := remote .SetupInstance (instanceConfig )
170
178
if err != nil {
171
179
klog .Fatalf ("Failed to setup instance %v: %v" , nodeID , err )
0 commit comments