Skip to content

Commit 9d6cf4d

Browse files
committed
Add new e2e test confirming StorageClass parameter
1 parent d97780c commit 9d6cf4d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/e2e/tests/single_zone_e2e_test.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,41 @@ var _ = Describe("GCE PD CSI Driver", func() {
283283
Expect(err).To(BeNil(), "Could not find disk in correct zone")
284284
}
285285
})
286+
287+
It("Should create a volume with allowed disk topology and confirm disk support label", func() {
288+
Expect(testContexts).ToNot(BeEmpty())
289+
testContext := getRandomTestContext()
290+
291+
volName := testNamePrefix + string(uuid.NewUUID())
292+
params := map[string]string{
293+
"type": hdbDiskType,
294+
// Required to enable the disk topology feature.
295+
"use-allowed-disk-topology": "true",
296+
}
297+
298+
topReq := &csi.TopologyRequirement{
299+
Requisite: []*csi.Topology{
300+
{
301+
Segments: map[string]string{common.TopologyKeyZone: "us-central1-c"},
302+
},
303+
},
304+
}
305+
306+
volume, err := testContext.Client.CreateVolume(volName, params, defaultSizeGb, topReq, nil)
307+
Expect(err).To(BeNil(), "Failed to create volume")
308+
defer func() {
309+
err = testContext.Client.DeleteVolume(volume.VolumeId)
310+
Expect(err).To(BeNil(), "Failed to delete volume")
311+
}()
312+
313+
// Confirm that the topologies include a disk support label
314+
Expect(volume.AccessibleTopology).ToNot(BeEmpty(), "Volume should have accessible topologies")
315+
Expect(volume.AccessibleTopology).To(HaveLen(1), "Expected exactly one accessible topology") // Zonal clusters have a single Topology.
316+
segments := volume.AccessibleTopology[0].Segments
317+
Expect(segments).To(HaveKeyWithValue(common.TopologyKeyZone, "us-central1-c"), "Topology should include zone segment with value 'us-central1-c'")
318+
Expect(segments).To(HaveKeyWithValue(common.DiskTypeLabelKey(hdbDiskType), "true"), "Topology should include disk type label with value 'true'")
319+
})
320+
286321
// TODO(hime): Enable this test once all release branches contain the fix from PR#1708.
287322
// It("Should return InvalidArgument when disk size exceeds limit", func() {
288323
// // If this returns a different error code (like Unknown), the error wrapping logic in #1708 has regressed.

0 commit comments

Comments
 (0)