File tree 4 files changed +74
-0
lines changed
4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ package apitest
2
+
3
+ import (
4
+ "os"
5
+ "testing"
6
+
7
+ "github.com/kubernetes-csi/csi-test/pkg/sanity"
8
+ )
9
+
10
+ func TestMyDriver (t * testing.T ) {
11
+ config := & sanity.Config {
12
+ TargetPath : os .TempDir () + "/csi" ,
13
+ StagingPath : os .TempDir () + "/csi" ,
14
+ Address : "/tmp/e2e-csi-sanity.sock" ,
15
+ }
16
+
17
+ sanity .Test (t , config )
18
+ }
Original file line number Diff line number Diff line change @@ -35,6 +35,25 @@ runTestWithCreds()
35
35
fi
36
36
}
37
37
38
+ runTestAPI ()
39
+ {
40
+ CSI_ENDPOINT=$1 ./bin/mock &
41
+ local pid=$!
42
+
43
+ GOCACHE=off go test -v ./hack/apitest/api_test.go; ret=$?
44
+
45
+ if [ $ret -ne 0 ] ; then
46
+ exit $ret
47
+ fi
48
+
49
+ GOCACHE=off go test -v ./hack/embedded/embedded_test.go; ret=$?
50
+ kill -9 $pid
51
+
52
+ if [ $ret -ne 0 ] ; then
53
+ exit $ret
54
+ fi
55
+ }
56
+
38
57
go build -o bin/mock ./mock || exit 1
39
58
40
59
cd cmd/csi-sanity
@@ -47,4 +66,7 @@ rm -f $UDS
47
66
runTestWithCreds " ${UDS} " " ${UDS} "
48
67
rm -f $UDS
49
68
69
+ runTestAPI " ${UDS} "
70
+ rm -f $UDS
71
+
50
72
exit 0
Original file line number Diff line number Diff line change
1
+ package embedded
2
+
3
+ import (
4
+ "os"
5
+ "testing"
6
+
7
+ "github.com/kubernetes-csi/csi-test/pkg/sanity"
8
+ . "github.com/onsi/ginkgo"
9
+ . "github.com/onsi/gomega"
10
+ )
11
+
12
+ func TestMyDriverGinkgo (t * testing.T ) {
13
+ RegisterFailHandler (Fail )
14
+ RunSpecs (t , "CSI Sanity Test Suite" )
15
+ }
16
+
17
+ var _ = Describe ("MyCSIDriver" , func () {
18
+ Context ("Config A" , func () {
19
+ config := & sanity.Config {
20
+ TargetPath : os .TempDir () + "/csi" ,
21
+ StagingPath : os .TempDir () + "/csi" ,
22
+ Address : "/tmp/e2e-csi-sanity.sock" ,
23
+ }
24
+
25
+ BeforeEach (func () {})
26
+
27
+ AfterEach (func () {})
28
+
29
+ Describe ("CSI Driver Test Suite" , func () {
30
+ sanity .GinkgoTest (config )
31
+ })
32
+ })
33
+ })
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ func GinkgoTest(reqConfig *Config) {
95
95
Config : reqConfig ,
96
96
}
97
97
98
+ address = sc .Config .Address
98
99
registerTestsInGinkgo (sc )
99
100
}
100
101
You can’t perform that action at this time.
0 commit comments