Skip to content

Commit

Permalink
Gate execution of missing volume test case for NodeUnpublishVolume
Browse files Browse the repository at this point in the history
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
container-storage-interface/spec#433 is
addressed, we can update the tests acccordingly.
  • Loading branch information
timoreimann committed May 20, 2020
1 parent a6fb595 commit d611c4d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions cmd/csi-sanity/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 5 additions & 0 deletions pkg/sanity/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
11 changes: 6 additions & 5 deletions pkg/sanity/sanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d611c4d

Please sign in to comment.