File tree 3 files changed +15
-19
lines changed
3 files changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,14 @@ func TestProbe(t *testing.T) {
71
71
defer csiConn .Close ()
72
72
73
73
var injectedErr error
74
+
75
+ // Setting up expected calls' responses
76
+ inPlugin := & csi.GetPluginInfoRequest {}
77
+ outPlugin := & csi.GetPluginInfoResponse {
78
+ Name : "foo/bar" ,
79
+ }
80
+ idServer .EXPECT ().GetPluginInfo (gomock .Any (), inPlugin ).Return (outPlugin , injectedErr ).Times (1 )
81
+
74
82
inProbe := & csi.ProbeRequest {}
75
83
outProbe := & csi.ProbeResponse {}
76
84
idServer .EXPECT ().Probe (gomock .Any (), inProbe ).Return (outProbe , injectedErr ).Times (1 )
Original file line number Diff line number Diff line change 42
42
)
43
43
44
44
func runProbe (ctx context.Context , csiConn connection.CSIConnection ) error {
45
+ // Get CSI driver name.
46
+ glog .Infof ("Calling CSI driver to discover driver name." )
47
+ csiDriverName , err := csiConn .GetDriverName (ctx )
48
+ if err != nil {
49
+ return err
50
+ }
51
+ glog .Infof ("CSI driver name: %q" , csiDriverName )
45
52
// Sending Probe request
46
53
glog .Infof ("Sending probe request to CSI driver." )
47
54
if err := csiConn .LivenessProbe (ctx ); err != nil {
Original file line number Diff line number Diff line change @@ -36,9 +36,6 @@ type CSIConnection interface {
36
36
// call.
37
37
GetDriverName (ctx context.Context ) (string , error )
38
38
39
- // NodeGetId returns node ID of the current according to the CSI driver.
40
- NodeGetId (ctx context.Context ) (string , error )
41
-
42
39
// Liveness Probe
43
40
LivenessProbe (ctx context.Context ) error
44
41
@@ -126,22 +123,6 @@ func (c *csiConnection) LivenessProbe(ctx context.Context) error {
126
123
return nil
127
124
}
128
125
129
- func (c * csiConnection ) NodeGetId (ctx context.Context ) (string , error ) {
130
- client := csi .NewNodeClient (c .conn )
131
-
132
- req := csi.NodeGetIdRequest {}
133
-
134
- rsp , err := client .NodeGetId (ctx , & req )
135
- if err != nil {
136
- return "" , err
137
- }
138
- nodeID := rsp .GetNodeId ()
139
- if nodeID == "" {
140
- return "" , fmt .Errorf ("node ID is empty" )
141
- }
142
- return nodeID , nil
143
- }
144
-
145
126
func (c * csiConnection ) Close () error {
146
127
return c .conn .Close ()
147
128
}
You can’t perform that action at this time.
0 commit comments