Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make probe universal #18

Merged
merged 3 commits into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions cmd/livenessprobe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,15 @@ func createMockServer(t *testing.T) (
}

func TestProbe(t *testing.T) {
mockController, driver, idServer, _, nodeServer, csiConn, err := createMockServer(t)
mockController, driver, idServer, _, _, csiConn, err := createMockServer(t)
if err != nil {
t.Fatal(err)
}
defer mockController.Finish()
defer driver.Stop()
defer csiConn.Close()

// Setting up expected calls' responses
inPlugin := &csi.GetPluginInfoRequest{}
outPlugin := &csi.GetPluginInfoResponse{
Name: "foo/bar",
}
var injectedErr error
idServer.EXPECT().GetPluginInfo(gomock.Any(), inPlugin).Return(outPlugin, injectedErr).Times(1)

inNode := &csi.NodeGetIdRequest{}
outNode := &csi.NodeGetIdResponse{
NodeId: "test_node_id",
}
nodeServer.EXPECT().NodeGetId(gomock.Any(), inNode).Return(outNode, injectedErr).Times(1)
inProbe := &csi.ProbeRequest{}
outProbe := &csi.ProbeResponse{}
idServer.EXPECT().Probe(gomock.Any(), inProbe).Return(outProbe, injectedErr).Times(1)
Expand Down
17 changes: 0 additions & 17 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@ var (
)

func runProbe(ctx context.Context, csiConn connection.CSIConnection) error {

// Get CSI driver name.
glog.Infof("Calling CSI driver to discover driver name.")
csiDriverName, err := csiConn.GetDriverName(ctx)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave GetDriverName part as it is as it should be retrived from GetPluginInfo() which is RPC from identity service?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, restored..

if err != nil {
return err
}
glog.Infof("CSI driver name: %q", csiDriverName)

// Get CSI Driver Node ID
glog.Infof("Calling CSI driver to discover node ID.")
csiDriverNodeID, err := csiConn.NodeGetId(ctx)
if err != nil {
return err
}
glog.Infof("CSI driver node ID: %q", csiDriverNodeID)

// Sending Probe request
glog.Infof("Sending probe request to CSI driver.")
if err := csiConn.LivenessProbe(ctx); err != nil {
Expand Down