From d611c4d97c3cc3f40b1e262375b00d6d9f5c26b5 Mon Sep 17 00:00:00 2001 From: Timo Reimann Date: Fri, 17 Apr 2020 09:24:19 +0200 Subject: [PATCH] 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. Once https://github.com/container-storage-interface/spec/issues/433 is addressed, we can update the tests acccordingly. --- cmd/csi-sanity/main.go | 1 + pkg/sanity/node.go | 5 +++++ pkg/sanity/sanity.go | 11 ++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/csi-sanity/main.go b/cmd/csi-sanity/main.go index 7c3235c0..84f81d2d 100644 --- a/cmd/csi-sanity/main.go +++ b/cmd/csi-sanity/main.go @@ -85,6 +85,7 @@ func main() { stringVar(&config.TestVolumeParametersFile, "testvolumeparameters", "YAML file of volume parameters for provisioned volumes") stringVar(&config.TestSnapshotParametersFile, "testsnapshotparameters", "YAML file of snapshot parameters for provisioned snapshots") boolVar(&config.TestNodeVolumeAttachLimit, "testnodevolumeattachlimit", "Test node volume attach limit") + boolVar(&config.TestNodeUnpublishVolumeMissingVolume, "testnodeunpublishvolumemissingvolume", "Test case for missing volume on NodeUnpublishVolume") stringVar(&config.JUnitFile, "junitfile", "JUnit XML output file where test results will be written") flag.Parse() diff --git a/pkg/sanity/node.go b/pkg/sanity/node.go index cd759101..f9b766e2 100644 --- a/pkg/sanity/node.go +++ b/pkg/sanity/node.go @@ -422,6 +422,11 @@ var _ = DescribeSanity("Node Service", func(sc *TestContext) { It("should fail when the volume is missing", func() { + if !sc.Config.TestNodeUnpublishVolumeMissingVolume { + // The gate is needed until https://github.com/container-storage-interface/spec/issues/433 is addressed. + Skip("missing volume on NodeUnpublishVolume disabled") + } + _, err := c.NodeUnpublishVolume( context.Background(), &csi.NodeUnpublishVolumeRequest{ diff --git a/pkg/sanity/sanity.go b/pkg/sanity/sanity.go index 06047e14..2b2b8d5e 100644 --- a/pkg/sanity/sanity.go +++ b/pkg/sanity/sanity.go @@ -91,11 +91,12 @@ type TestConfig struct { TestVolumeSize int64 // Target size for ExpandVolume requests. If not specified it defaults to TestVolumeSize + 1 GB - TestVolumeExpandSize int64 - TestVolumeParametersFile string - TestVolumeParameters map[string]string - TestNodeVolumeAttachLimit bool - TestVolumeAccessType string + TestVolumeExpandSize int64 + TestVolumeParametersFile string + TestVolumeParameters map[string]string + TestNodeVolumeAttachLimit bool + TestVolumeAccessType string + TestNodeUnpublishVolumeMissingVolume bool // JUnitFile is used by Test to store test results in JUnit // format. When using GinkgoTest, the caller is responsible