-
Notifications
You must be signed in to change notification settings - Fork 8
/
csi.go
36 lines (31 loc) · 934 Bytes
/
csi.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"fmt"
"os"
"path/filepath"
"strings"
"k8s.io/kubernetes/test/e2e/framework/testfiles"
"k8s.io/kubernetes/test/e2e/storage/external"
)
const (
manifestEnvVar = "TEST_CSI_DRIVER_FILES"
)
// Initialize openshift/csi suite, i.e. define CSI tests from TEST_CSI_DRIVER_FILES.
func initCSITests(dryRun bool) error {
manifestList := os.Getenv(manifestEnvVar)
if manifestList != "" {
manifests := strings.Split(manifestList, ",")
for _, manifest := range manifests {
if err := external.AddDriverDefinition(manifest); err != nil {
return fmt.Errorf("failed to load manifest from %q: %s", manifest, err)
}
// Register the base dir of the manifest file as a file source.
// With this we can reference the CSI driver's storageClass
// in the manifest file (FromFile field).
testfiles.AddFileSource(testfiles.RootFileSource{
Root: filepath.Dir(manifest),
})
}
}
return nil
}