Skip to content

Commit 3a88fe1

Browse files
committed
fix test suite issue
1 parent a6420e8 commit 3a88fe1

File tree

5 files changed

+25
-18
lines changed

5 files changed

+25
-18
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ func urlFlag(target **url.URL, name string, usage string) {
352352
}
353353

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

test/e2e/tests/setup_e2e_test.go

+20-13
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ var _ = BeforeSuite(func() {
8181
defer close(hdtcc)
8282

8383
zones := strings.Split(*zones, ",")
84-
// Create 2 instances for each zone as we need 2 instances each zone for certain test cases
85-
8684
rand.Seed(time.Now().UnixNano())
8785

8886
computeService, err = remote.GetComputeClient()
@@ -109,27 +107,31 @@ var _ = BeforeSuite(func() {
109107

110108
numberOfInstancesPerZone := 2
111109

112-
setupContext := func(zones []string, randInt int) {
113-
for _, zone := range zones {
114-
go func(curZone string) {
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) {
115114
defer GinkgoRecover()
116115
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))
121-
}(zone)
116+
}(zone, j)
122117
}
118+
go func(curZone string) {
119+
defer GinkgoRecover()
120+
hdtcc <- NewTestContext(curZone, *hdMinCpuPlatform, *hdMachineType, "0")
121+
}(zone)
123122
}
124-
for j := 0; j < numberOfInstancesPerZone; j++ {
125-
setupContext(zones, j)
123+
124+
for _, zone := range zones {
125+
setupContext(zone)
126126
}
127127

128128
for i := 0; i < len(zones)*numberOfInstancesPerZone; i++ {
129129
tc := <-tcc
130130
testContexts = append(testContexts, tc)
131131
klog.Infof("Added TestContext for node %s", tc.Instance.GetName())
132-
tc = <-hdtcc
132+
}
133+
for i := 0; i < len(zones); i++ {
134+
tc := <-hdtcc
133135
hyperdiskTestContexts = append(hyperdiskTestContexts, tc)
134136
klog.Infof("Added TestContext for node %s", tc.Instance.GetName())
135137
}
@@ -178,6 +180,11 @@ func NewTestContext(zone, minCpuPlatform, machineType string, instanceNumber str
178180
ComputeService: computeService,
179181
LocalSSDCount: localSSDCount,
180182
}
183+
184+
if machineType == *hdMachineType {
185+
// Machine type is defaulted to c3-standard-2 which doesn't support LSSD and we don't need LSSD for HdHA test context
186+
instanceConfig.LocalSSDCount = 0
187+
}
181188
i, err := remote.SetupInstance(instanceConfig)
182189
if err != nil {
183190
klog.Fatalf("Failed to setup instance %v: %v", nodeID, err)

test/e2e/utils/utils.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ func GCEClientAndDriverSetup(instance *remote.InstanceInfo, driverConfig DriverC
8181
workspace := remote.NewWorkspaceDir("gce-pd-e2e-")
8282
// Log at V(6) as the compute API calls are emitted at that level and it's
8383
// useful to see what's happening when debugging tests.
84-
driverRunCmd := fmt.Sprintf("sh -c '/usr/bin/nohup %s/gce-pd-csi-driver -v=6 --endpoint=%s %s 2> %s/prog.out < /dev/null > /dev/null &'",
84+
driverRunCmd := fmt.Sprintf("sh -c '/usr/bin/nohup %s/gce-pd-csi-driver -v=2 --endpoint=%s %s 2> %s/prog.out < /dev/null > /dev/null &'",
8585
workspace, endpoint, strings.Join(extra_flags, " "), workspace)
86+
klog.Infof("driverCmd %s", driverRunCmd)
8687
config := &remote.ClientConfig{
8788
PkgPath: pkgPath,
8889
BinPath: binPath,

test/remote/instance.go

-1
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",

test/run-e2e.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ set -x
55

66
readonly PKGDIR=sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
77

8-
TIMEOUT=50m
8+
TIMEOUT=20m
99
if [ "$RUN_CONTROLLER_MODIFY_VOLUME_TESTS" = true ]; then
1010
TIMEOUT=45m
1111
fi
1212

13-
go test --timeout "${TIMEOUT}" --v "${PKGDIR}/test/e2e/tests" --run-in-prow=true --delete-instances=true --logtostderr $@
13+
go test --timeout "${TIMEOUT}" --v=6 "${PKGDIR}/test/e2e/tests" --run-in-prow=true --delete-instances=false --logtostderr $@

0 commit comments

Comments
 (0)