@@ -17,18 +17,70 @@ limitations under the License.
17
17
package sanity
18
18
19
19
import (
20
+ "fmt"
20
21
"regexp"
21
22
23
+ "google.golang.org/grpc/codes"
24
+ "google.golang.org/grpc/status"
25
+
22
26
csi "github.com/container-storage-interface/spec/lib/go/csi/v0"
23
27
context "golang.org/x/net/context"
24
28
25
29
. "github.com/onsi/ginkgo"
26
30
. "github.com/onsi/gomega"
27
31
)
28
32
29
- // TODO: Tests for GetPluginCapabilities
33
+ var _ = Describe ("GetPluginCapabilities [Identity Service]" , func () {
34
+ var (
35
+ c csi.IdentityClient
36
+ )
37
+
38
+ BeforeEach (func () {
39
+ c = csi .NewIdentityClient (conn )
40
+ })
41
+
42
+ It ("should return appropriate capabilities" , func () {
43
+ req := & csi.GetPluginCapabilitiesRequest {}
44
+ res , err := c .GetPluginCapabilities (context .Background (), req )
45
+ Expect (err ).NotTo (HaveOccurred ())
46
+ Expect (res ).NotTo (BeNil ())
47
+
48
+ By ("checking successful response" )
49
+ Expect (res .GetCapabilities ()).NotTo (BeNil ())
50
+ for _ , cap := range res .GetCapabilities () {
51
+ switch cap .GetService ().GetType () {
52
+ case csi .PluginCapability_Service_CONTROLLER_SERVICE :
53
+ default :
54
+ Fail (fmt .Sprintf ("Unknown capability: %v\n " , cap .GetService ().GetType ()))
55
+ }
56
+ }
57
+
58
+ })
59
+
60
+ })
61
+
62
+ var _ = Describe ("Probe [Identity Service]" , func () {
63
+ var (
64
+ c csi.IdentityClient
65
+ )
30
66
31
- // TODO: Tests for Probe
67
+ BeforeEach (func () {
68
+ c = csi .NewIdentityClient (conn )
69
+ })
70
+
71
+ It ("should return appropriate information" , func () {
72
+ req := & csi.ProbeRequest {}
73
+ res , err := c .Probe (context .Background (), req )
74
+ Expect (err ).NotTo (HaveOccurred ())
75
+ Expect (res ).NotTo (BeNil ())
76
+
77
+ By ("verifying return status" )
78
+ serverError , ok := status .FromError (err )
79
+ Expect (ok ).To (BeTrue ())
80
+ Expect (serverError .Code () == codes .FailedPrecondition ||
81
+ serverError .Code () == codes .OK ).To (BeTrue ())
82
+ })
83
+ })
32
84
33
85
var _ = Describe ("GetPluginInfo [Identity Server]" , func () {
34
86
var (
0 commit comments