File tree Expand file tree Collapse file tree 4 files changed +77
-0
lines changed
Expand file tree Collapse file tree 4 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 1+ package apitest
2+
3+ import (
4+ "fmt"
5+ "os"
6+ "testing"
7+
8+ "github.com/kubernetes-csi/csi-test/pkg/sanity"
9+ )
10+
11+ func TestMyDriver (t * testing.T ) {
12+ fmt .Println ("Go API test" )
13+
14+ config := & sanity.Config {
15+ TargetPath : os .TempDir () + "/csi" ,
16+ StagingPath : os .TempDir () + "/csi" ,
17+ Address : "/tmp/e2e-csi-sanity.sock" ,
18+ }
19+
20+ sanity .Test (t , config )
21+ }
Original file line number Diff line number Diff line change @@ -35,6 +35,25 @@ runTestWithCreds()
3535 fi
3636}
3737
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+
3857go build -o bin/mock ./mock || exit 1
3958
4059cd cmd/csi-sanity
@@ -47,4 +66,7 @@ rm -f $UDS
4766runTestWithCreds " ${UDS} " " ${UDS} "
4867rm -f $UDS
4968
69+ runTestAPI " ${UDS} "
70+ rm -f $UDS
71+
5072exit 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) {
9595 Config : reqConfig ,
9696 }
9797
98+ address = sc .Config .Address
9899 registerTestsInGinkgo (sc )
99100}
100101
You can’t perform that action at this time.
0 commit comments