Skip to content

Commit 1f1080b

Browse files
committed
Gate execution of missing volume test case for NodeUnpublishVolume
The "should fail when the volume is missing" test for NodeUnpublishVolume verifies that a NotFound error occurs when the endpoint is invoked for a missing volume. However, this expectation really only holds for volume types that are locally attached, such as local disks or iscsi. Specifically, it would not hold for network-attached storage where it is fine to return Ok if the mount point does not exist. This change introduces a flag to gate execution of the test, defaulting it not running since that was the behavior we have had before.
1 parent a6fb595 commit 1f1080b

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

cmd/csi-sanity/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func main() {
8585
stringVar(&config.TestVolumeParametersFile, "testvolumeparameters", "YAML file of volume parameters for provisioned volumes")
8686
stringVar(&config.TestSnapshotParametersFile, "testsnapshotparameters", "YAML file of snapshot parameters for provisioned snapshots")
8787
boolVar(&config.TestNodeVolumeAttachLimit, "testnodevolumeattachlimit", "Test node volume attach limit")
88+
boolVar(&config.TestNodeUnpublishVolumeMissingVolume, "testnodeunpublishvolumemissingvolume", "Test case for missing volume on NodeUnpublishVolume")
8889
stringVar(&config.JUnitFile, "junitfile", "JUnit XML output file where test results will be written")
8990

9091
flag.Parse()

pkg/sanity/node.go

+4
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ var _ = DescribeSanity("Node Service", func(sc *TestContext) {
422422

423423
It("should fail when the volume is missing", func() {
424424

425+
if !sc.Config.TestNodeUnpublishVolumeMissingVolume {
426+
Skip("missing volume on NodeUnpublishVolume disabled")
427+
}
428+
425429
_, err := c.NodeUnpublishVolume(
426430
context.Background(),
427431
&csi.NodeUnpublishVolumeRequest{

pkg/sanity/sanity.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ type TestConfig struct {
9191
TestVolumeSize int64
9292

9393
// Target size for ExpandVolume requests. If not specified it defaults to TestVolumeSize + 1 GB
94-
TestVolumeExpandSize int64
95-
TestVolumeParametersFile string
96-
TestVolumeParameters map[string]string
97-
TestNodeVolumeAttachLimit bool
98-
TestVolumeAccessType string
94+
TestVolumeExpandSize int64
95+
TestVolumeParametersFile string
96+
TestVolumeParameters map[string]string
97+
TestNodeVolumeAttachLimit bool
98+
TestVolumeAccessType string
99+
TestNodeUnpublishVolumeMissingVolume bool
99100

100101
// JUnitFile is used by Test to store test results in JUnit
101102
// format. When using GinkgoTest, the caller is responsible

0 commit comments

Comments
 (0)