Skip to content

Commit 104dd3e

Browse files
committed
fix test suite issue
1 parent a6420e8 commit 104dd3e

File tree

5 files changed

+17
-33
lines changed

5 files changed

+17
-33
lines changed

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,12 @@ var (
5050
cloudtopHost = flag.Bool("cloudtop-host", false, "The local host is cloudtop, a kind of googler machine with special requirements to access GCP")
5151
extraDriverFlags = flag.String("extra-driver-flags", "", "Extra flags to pass to the driver")
5252
enableConfidentialCompute = flag.Bool("enable-confidential-compute", false, "Create VMs with confidential compute mode. This uses NVMe devices")
53-
hdMachineType = flag.String("hyperdisk-machine-type", "c3-standard-4", "Type of machine to provision instance on")
54-
hdMinCpuPlatform = flag.String("hyperdisk-min-cpu-platform", "sapphirerapids", "Minimum CPU architecture")
55-
56-
testContexts = []*remote.TestContext{}
57-
hyperdiskTestContexts = []*remote.TestContext{}
58-
computeService *compute.Service
59-
computeAlphaService *computealpha.Service
60-
computeBetaService *computebeta.Service
61-
kmsClient *cloudkms.KeyManagementClient
53+
54+
testContexts = []*remote.TestContext{}
55+
computeService *compute.Service
56+
computeAlphaService *computealpha.Service
57+
computeBetaService *computebeta.Service
58+
kmsClient *cloudkms.KeyManagementClient
6259
)
6360

6461
const localSSDCount int64 = 2
@@ -76,9 +73,7 @@ func TestE2E(t *testing.T) {
7673
var _ = BeforeSuite(func() {
7774
var err error
7875
tcc := make(chan *remote.TestContext)
79-
hdtcc := make(chan *remote.TestContext)
8076
defer close(tcc)
81-
defer close(hdtcc)
8277

8378
zones := strings.Split(*zones, ",")
8479
// Create 2 instances for each zone as we need 2 instances each zone for certain test cases
@@ -113,11 +108,7 @@ var _ = BeforeSuite(func() {
113108
for _, zone := range zones {
114109
go func(curZone string) {
115110
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))
111+
tcc <- NewTestContext(curZone, strconv.Itoa(randInt))
121112
}(zone)
122113
}
123114
}
@@ -129,9 +120,6 @@ var _ = BeforeSuite(func() {
129120
tc := <-tcc
130121
testContexts = append(testContexts, tc)
131122
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())
135123
}
136124
})
137125

@@ -156,21 +144,17 @@ func getDriverConfig() testutils.DriverConfig {
156144
}
157145
}
158146

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)
147+
func NewTestContext(zone string, instanceNumber string) *remote.TestContext {
148+
nodeID := fmt.Sprintf("%s-%s-%s", *vmNamePrefix, zone, instanceNumber)
165149
klog.Infof("Setting up node %s", nodeID)
166150

167151
instanceConfig := remote.InstanceConfig{
168152
Project: *project,
169153
Architecture: *architecture,
170-
MinCpuPlatform: minCpuPlatform,
154+
MinCpuPlatform: *minCpuPlatform,
171155
Zone: zone,
172156
Name: nodeID,
173-
MachineType: machineType,
157+
MachineType: *machineType,
174158
ServiceAccount: *serviceAccount,
175159
ImageURL: *imageURL,
176160
CloudtopHost: *cloudtopHost,
@@ -200,12 +184,12 @@ func NewTestContext(zone, minCpuPlatform, machineType string, instanceNumber str
200184
pkgs := []string{"lvm2", "mdadm", "grep", "coreutils"}
201185
err = testutils.InstallDependencies(i, pkgs)
202186
if err != nil {
203-
klog.Fatalf("Failed to install dependency package on node %v: error : %v", i.GetNodeID(), err)
187+
klog.Errorf("Failed to install dependency package on node %v: error : %v", i.GetNodeID(), err)
204188
}
205189

206190
err = testutils.SetupDataCachingConfig(i)
207191
if err != nil {
208-
klog.Fatalf("Failed to setup data cache required config error %v", err)
192+
klog.Errorf("Failed to setup data cache required config error %v", err)
209193
}
210194
klog.Infof("Creating new driver and client for node %s", i.GetName())
211195
tc, err := testutils.GCEClientAndDriverSetup(i, getDriverConfig())

test/e2e/utils/utils.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ func GCEClientAndDriverSetup(instance *remote.InstanceInfo, driverConfig DriverC
8383
// useful to see what's happening when debugging tests.
8484
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 &'",
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

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

test/run-e2e.sh

Lines changed: 2 additions & 2 deletions
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 "${PKGDIR}/test/e2e/tests" --run-in-prow=true --delete-instances=false --logtostderr $@

0 commit comments

Comments
 (0)