Skip to content

Commit 902c6a6

Browse files
Update plugin_test.go
1 parent d0abca6 commit 902c6a6

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

agent/csi/plugin/plugin_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"net"
66
"testing"
77

8+
"github.com/container-storage-interface/spec/lib/go/csi"
89
"github.com/moby/swarmkit/v2/api"
910
"github.com/moby/swarmkit/v2/testutils"
1011

@@ -27,6 +28,30 @@ func newVolumeClient(name string, nodeID string) *nodePlugin {
2728
return n
2829
}
2930

31+
func TestMakeNodeInfo(t *testing.T) {
32+
csiNodeInfo := &csi.NodeGetInfoResponse{
33+
NodeId: "node-1",
34+
MaxVolumesPerNode: 26,
35+
AccessibleTopology: &csi.Topology{
36+
Segments: map[string]string{
37+
"topology.kubernetes.io/zone": "eu-central-1a",
38+
},
39+
},
40+
}
41+
42+
expected := &api.NodeCSIInfo{
43+
NodeID: "node-1",
44+
MaxVolumesPerNode: 26,
45+
AccessibleTopology: &api.Topology{
46+
Segments: map[string]string{
47+
"topology.kubernetes.io/zone": "eu-central-1a",
48+
},
49+
},
50+
}
51+
52+
assert.Equal(t, expected, makeNodeInfo(csiNodeInfo))
53+
}
54+
3055
func TestNodeStageVolume(t *testing.T) {
3156
plugin := "plugin-1"
3257
node := "node-1"

0 commit comments

Comments
 (0)