Skip to content

Commit 8e8e39c

Browse files
committed
Allow disabling local ssd tests
Change-Id: I56882f6bcaf0d86048756cebef008e7f4e516ce0
1 parent 88bb599 commit 8e8e39c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

test/e2e/tests/setup_e2e_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ var (
5858
hdMachineType = flag.String("hyperdisk-machine-type", "c3-standard-4", "Type of machine to provision instance on")
5959
hdMinCpuPlatform = flag.String("hyperdisk-min-cpu-platform", "sapphirerapids", "Minimum CPU architecture")
6060

61+
// Some architectures don't have local ssd. Give way to opt out of tests like datacache.
62+
skipLocalSsdTests = flag.Bool("skip-local-ssd-tests", false, "Skip local ssd tests like datacache")
63+
6164
testContexts = []*remote.TestContext{}
6265
hyperdiskTestContexts = []*remote.TestContext{}
6366
computeService *compute.Service
@@ -177,6 +180,13 @@ func NewDefaultTestContext(zone string, instanceNumber string) *remote.TestConte
177180
return NewTestContext(zone, *minCpuPlatform, *machineType, instanceNumber)
178181
}
179182

183+
func getLocalSsdCount() int64 {
184+
if *skipLocalSsdTests {
185+
return 0
186+
}
187+
return common.LocalSSDCountForDataCache
188+
}
189+
180190
func NewTestContext(zone, minCpuPlatform, machineType string, instanceNumber string) *remote.TestContext {
181191
nodeID := fmt.Sprintf("%s-%s-%s-%s", *vmNamePrefix, zone, machineType, instanceNumber)
182192
klog.Infof("Setting up node %s", nodeID)
@@ -193,7 +203,7 @@ func NewTestContext(zone, minCpuPlatform, machineType string, instanceNumber str
193203
CloudtopHost: *cloudtopHost,
194204
EnableConfidentialCompute: *enableConfidentialCompute,
195205
ComputeService: computeService,
196-
LocalSSDCount: common.LocalSSDCountForDataCache,
206+
LocalSSDCount: getLocalSsdCount(),
197207
}
198208

199209
if machineType == *hdMachineType {

test/e2e/tests/single_zone_e2e_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,9 @@ var _ = Describe("GCE PD CSI Driver", func() {
14831483
It("Should create disks, attach them to instance with local ssd, setup caching between LSSD->detach->reattach to same instance", func() {
14841484
Expect(testContexts).ToNot(BeEmpty())
14851485
testContext := getRandomTestContext()
1486+
if testContext.Instance.GetLocalSSD() == 0 {
1487+
Skip("Skipping data cache as no local ssd in context")
1488+
}
14861489

14871490
p, z, _ := testContext.Instance.GetIdentity()
14881491
client := testContext.Client

0 commit comments

Comments
 (0)