Skip to content

Commit 27b866a

Browse files
Sneha-atcemakd
authored andcommitted
fix test suite issue
1 parent 6ecf0ff commit 27b866a

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

cmd/gce-pd-csi-driver/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ func urlFlag(target **url.URL, name string, usage string) {
333333
}
334334

335335
func setupDataCache(ctx context.Context, nodeName string) error {
336-
klog.V(2).Infof("Seting up data cache for node %s", nodeName)
336+
klog.V(2).Infof("Setting up data cache for node %s", nodeName)
337337
if nodeName != common.TestNode {
338338
cfg, err := rest.InClusterConfig()
339339
if err != nil {

test/e2e/tests/setup_e2e_test.go

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"math/rand"
2222
"strconv"
2323
"strings"
24+
"sync"
2425
"testing"
2526
"time"
2627

@@ -72,11 +73,10 @@ func TestE2E(t *testing.T) {
7273

7374
var _ = BeforeSuite(func() {
7475
var err error
75-
tcc := make(chan *remote.TestContext)
76-
defer close(tcc)
77-
76+
numberOfInstancesPerZone := 2
7877
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)
8080

8181
rand.Seed(time.Now().UnixNano())
8282

@@ -102,18 +102,21 @@ var _ = BeforeSuite(func() {
102102

103103
klog.Infof("Running in project %v with service account %v", *project, *serviceAccount)
104104

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) {
110111
defer GinkgoRecover()
112+
defer wg.Done()
111113
tcc <- NewDefaultTestContext(curZone, strconv.Itoa(randInt))
112-
}(zone)
114+
}(zone, j)
113115
}
114116
}
115-
for j := 0; j < numberOfInstancesPerZone; j++ {
116-
setupContext(zones, j)
117+
118+
for _, zone := range zones {
119+
setupContext(zone)
117120
}
118121

119122
for i := 0; i < len(zones)*numberOfInstancesPerZone; i++ {
@@ -166,6 +169,11 @@ func NewTestContext(zone, minCpuPlatform, machineType string, instanceNumber str
166169
ComputeService: computeService,
167170
LocalSSDCount: localSSDCount,
168171
}
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+
}
169177
i, err := remote.SetupInstance(instanceConfig)
170178
if err != nil {
171179
klog.Fatalf("Failed to setup instance %v: %v", nodeID, err)

test/remote/instance.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ func (i *InstanceInfo) CreateOrGetInstance(localSSDCount int) error {
148148
EnableConfidentialCompute: true,
149149
}
150150
}
151-
klog.Infof("=======Adding LocalSSD %v=============", localSSDCount)
152151

153152
localSSDConfig := &compute.AttachedDisk{
154153
Type: "SCRATCH",

0 commit comments

Comments
 (0)