Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/csi-sanity/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func main() {
stringVar(&config.TestVolumeParametersFile, "testvolumeparameters", "YAML file of volume parameters for provisioned volumes")
stringVar(&config.TestVolumeMutableParametersFile, "testvolumemutableparameters", "YAML file of mutable parameters for modifying volumes")
stringVar(&config.TestSnapshotParametersFile, "testsnapshotparameters", "YAML file of snapshot parameters for provisioned snapshots")
stringVar(&config.TestTopologyRequirementsFile, "testtopologyrequirements", "YAML file of topology requirements for provisioned volumes")
boolVar(&config.TestNodeVolumeAttachLimit, "testnodevolumeattachlimit", "Test node volume attach limit")
flag.Var(flag.Lookup("ginkgo.junit-report").Value, prefix+"junitfile", "JUnit XML output file where test results will be written (deprecated: use ginkgo.junit-report instead)")

Expand Down
4 changes: 4 additions & 0 deletions pkg/sanity/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,10 @@ func MakeCreateVolumeReq(sc *TestContext, name string) *csi.CreateVolumeRequest
Parameters: sc.Config.TestVolumeParameters,
}

if sc.Config.TestTopologyRequirements != nil {
req.AccessibilityRequirements = sc.Config.TestTopologyRequirements
}

if sc.Secrets != nil {
req.Secrets = sc.Secrets.CreateVolumeSecret
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/sanity/sanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"strings"
"time"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/kubernetes-csi/csi-test/v5/utils"
yaml "gopkg.in/yaml.v2"

Expand Down Expand Up @@ -106,6 +107,10 @@ type TestConfig struct {
TestVolumeMutableParametersFile string
TestVolumeMutableParameters map[string]string

// TestTopologyRequirementsFile for setting CreateVolumeRequest.AccessibilityRequirements.
TestTopologyRequirementsFile string
TestTopologyRequirements *csi.TopologyRequirement

// Callback functions to customize the creation of target and staging
// directories. Returns the new paths for mount and staging.
// If not defined, directories are created in the default way at TargetPath
Expand Down Expand Up @@ -252,6 +257,8 @@ func (sc *TestContext) Setup() {
loadFromFile(sc.Config.TestSnapshotParametersFile, &sc.Config.TestSnapshotParameters)
// Get VolumeAttributeClass parameters from TestVolumeMutableParametersFile
loadFromFile(sc.Config.TestVolumeMutableParametersFile, &sc.Config.TestVolumeMutableParameters)
// Get TopologyRequirement parameters from TestTopologyRequirementsFile
loadFromFile(sc.Config.TestTopologyRequirementsFile, &sc.Config.TestTopologyRequirements)

if len(sc.Config.SecretsFile) > 0 {
sc.Secrets, err = loadSecrets(sc.Config.SecretsFile)
Expand Down