Skip to content

Commit

Permalink
Add CSI info test for agent
Browse files Browse the repository at this point in the history
Signed-off-by: Ameya Gawde <agawde@mirantis.com>
  • Loading branch information
ameyag committed Jul 30, 2020
1 parent 78c135e commit 0d17177
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions agent/agent_test.go
Expand Up @@ -437,6 +437,25 @@ func TestAgentExitsBasedOnSessionTracker(t *testing.T) {
require.Len(t, closedSessions, 3)
}

func TestAgentCSIInfo(t *testing.T) {
tlsCh := make(chan events.Event, 1)
defer close(tlsCh)
tester := agentTestEnv(t, nil, tlsCh)
fakeNodePlugin := &csi.NodePlugin{
name: "testDriver",
nodeID: "node1",
}
tester.agent.CSIInfo = append(fakeNodePlugin)
defer tester.cleanup()
defer tester.StartAgent(t)

currSession, closedSessions := tester.dispatcher.GetSessions()
require.NotNil(t, currSession)
require.NotNil(t, currSession.Description)
require.NotNil(t, currSession.Description.CSIInfo)
require.Equal(t, currSession.Description.CSIInfo[0].NodeID, fakeNodePlugin.nodeID)
}

// If we pass a session tracker, established sessions get tracked.
func TestAgentRegistersSessionsWithSessionTracker(t *testing.T) {
tlsCh := make(chan events.Event, 1)
Expand Down

0 comments on commit 0d17177

Please sign in to comment.