@@ -1119,8 +1119,26 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1119
1119
Expect (serverError .Code ()).To (Equal (codes .InvalidArgument ))
1120
1120
})
1121
1121
1122
+ // CSI spec poses no specific requirements for the cluster/storage setups that a SP MUST support. To perform
1123
+ // meaningful checks the following test assumes that topology-aware provisioning on a single node setup is supported
1122
1124
It ("should return appropriate values (no optional values added)" , func () {
1123
1125
1126
+ By ("getting node information" )
1127
+ ni , err := n .NodeGetInfo (
1128
+ context .Background (),
1129
+ & csi.NodeGetInfoRequest {})
1130
+ Expect (err ).NotTo (HaveOccurred ())
1131
+ Expect (ni ).NotTo (BeNil ())
1132
+ Expect (ni .GetNodeId ()).NotTo (BeEmpty ())
1133
+
1134
+ var accReqs * csi.TopologyRequirement
1135
+ if ni .AccessibleTopology != nil {
1136
+ // Topology requirements are honored if provided by the driver
1137
+ accReqs = & csi.TopologyRequirement {
1138
+ Requisite : []* csi.Topology {ni .AccessibleTopology },
1139
+ }
1140
+ }
1141
+
1124
1142
// Create Volume First
1125
1143
By ("creating a single node writer volume" )
1126
1144
name := UniqueString ("sanity-controller-publish" )
@@ -1139,8 +1157,9 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1139
1157
},
1140
1158
},
1141
1159
},
1142
- Secrets : sc .Secrets .CreateVolumeSecret ,
1143
- Parameters : sc .Config .TestVolumeParameters ,
1160
+ Secrets : sc .Secrets .CreateVolumeSecret ,
1161
+ Parameters : sc .Config .TestVolumeParameters ,
1162
+ AccessibilityRequirements : accReqs ,
1144
1163
},
1145
1164
)
1146
1165
Expect (err ).NotTo (HaveOccurred ())
@@ -1149,22 +1168,14 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1149
1168
Expect (vol .GetVolume ().GetVolumeId ()).NotTo (BeEmpty ())
1150
1169
cl .RegisterVolume (name , VolumeInfo {VolumeID : vol .GetVolume ().GetVolumeId ()})
1151
1170
1152
- By ("getting a node id" )
1153
- nid , err := n .NodeGetInfo (
1154
- context .Background (),
1155
- & csi.NodeGetInfoRequest {})
1156
- Expect (err ).NotTo (HaveOccurred ())
1157
- Expect (nid ).NotTo (BeNil ())
1158
- Expect (nid .GetNodeId ()).NotTo (BeEmpty ())
1159
-
1160
1171
// ControllerPublishVolume
1161
1172
By ("calling controllerpublish on that volume" )
1162
1173
1163
1174
conpubvol , err := c .ControllerPublishVolume (
1164
1175
context .Background (),
1165
1176
& csi.ControllerPublishVolumeRequest {
1166
1177
VolumeId : vol .GetVolume ().GetVolumeId (),
1167
- NodeId : nid .GetNodeId (),
1178
+ NodeId : ni .GetNodeId (),
1168
1179
VolumeCapability : & csi.VolumeCapability {
1169
1180
AccessType : & csi.VolumeCapability_Mount {
1170
1181
Mount : & csi.VolumeCapability_MountVolume {},
@@ -1178,7 +1189,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1178
1189
},
1179
1190
)
1180
1191
Expect (err ).NotTo (HaveOccurred ())
1181
- cl .RegisterVolume (name , VolumeInfo {VolumeID : vol .GetVolume ().GetVolumeId (), NodeID : nid .GetNodeId ()})
1192
+ cl .RegisterVolume (name , VolumeInfo {VolumeID : vol .GetVolume ().GetVolumeId (), NodeID : ni .GetNodeId ()})
1182
1193
Expect (conpubvol ).NotTo (BeNil ())
1183
1194
1184
1195
By ("cleaning up unpublishing the volume" )
@@ -1188,7 +1199,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1188
1199
& csi.ControllerUnpublishVolumeRequest {
1189
1200
VolumeId : vol .GetVolume ().GetVolumeId (),
1190
1201
// NodeID is optional in ControllerUnpublishVolume
1191
- NodeId : nid .GetNodeId (),
1202
+ NodeId : ni .GetNodeId (),
1192
1203
Secrets : sc .Secrets .ControllerUnpublishVolumeSecret ,
1193
1204
},
1194
1205
)
@@ -1474,12 +1485,30 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1474
1485
Expect (serverError .Code ()).To (Equal (codes .InvalidArgument ))
1475
1486
})
1476
1487
1488
+ // CSI spec poses no specific requirements for the cluster/storage setups that a SP MUST support. To perform
1489
+ // meaningful checks the following test assumes that topology-aware provisioning on a single node setup is supported
1477
1490
It ("should return appropriate values (no optional values added)" , func () {
1478
1491
1479
1492
// Create Volume First
1480
1493
By ("creating a single node writer volume" )
1481
1494
name := UniqueString ("sanity-controller-unpublish" )
1482
1495
1496
+ By ("getting node information" )
1497
+ ni , err := n .NodeGetInfo (
1498
+ context .Background (),
1499
+ & csi.NodeGetInfoRequest {})
1500
+ Expect (err ).NotTo (HaveOccurred ())
1501
+ Expect (ni ).NotTo (BeNil ())
1502
+ Expect (ni .GetNodeId ()).NotTo (BeEmpty ())
1503
+
1504
+ var accReqs * csi.TopologyRequirement
1505
+ if ni .AccessibleTopology != nil {
1506
+ // Topology requirements are honored if provided by the driver
1507
+ accReqs = & csi.TopologyRequirement {
1508
+ Requisite : []* csi.Topology {ni .AccessibleTopology },
1509
+ }
1510
+ }
1511
+
1483
1512
vol , err := c .CreateVolume (
1484
1513
context .Background (),
1485
1514
& csi.CreateVolumeRequest {
@@ -1494,8 +1523,9 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1494
1523
},
1495
1524
},
1496
1525
},
1497
- Secrets : sc .Secrets .CreateVolumeSecret ,
1498
- Parameters : sc .Config .TestVolumeParameters ,
1526
+ Secrets : sc .Secrets .CreateVolumeSecret ,
1527
+ Parameters : sc .Config .TestVolumeParameters ,
1528
+ AccessibilityRequirements : accReqs ,
1499
1529
},
1500
1530
)
1501
1531
Expect (err ).NotTo (HaveOccurred ())
@@ -1504,22 +1534,14 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1504
1534
Expect (vol .GetVolume ().GetVolumeId ()).NotTo (BeEmpty ())
1505
1535
cl .RegisterVolume (name , VolumeInfo {VolumeID : vol .GetVolume ().GetVolumeId ()})
1506
1536
1507
- By ("getting a node id" )
1508
- nid , err := n .NodeGetInfo (
1509
- context .Background (),
1510
- & csi.NodeGetInfoRequest {})
1511
- Expect (err ).NotTo (HaveOccurred ())
1512
- Expect (nid ).NotTo (BeNil ())
1513
- Expect (nid .GetNodeId ()).NotTo (BeEmpty ())
1514
-
1515
1537
// ControllerPublishVolume
1516
1538
By ("calling controllerpublish on that volume" )
1517
1539
1518
1540
conpubvol , err := c .ControllerPublishVolume (
1519
1541
context .Background (),
1520
1542
& csi.ControllerPublishVolumeRequest {
1521
1543
VolumeId : vol .GetVolume ().GetVolumeId (),
1522
- NodeId : nid .GetNodeId (),
1544
+ NodeId : ni .GetNodeId (),
1523
1545
VolumeCapability : & csi.VolumeCapability {
1524
1546
AccessType : & csi.VolumeCapability_Mount {
1525
1547
Mount : & csi.VolumeCapability_MountVolume {},
@@ -1533,7 +1555,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1533
1555
},
1534
1556
)
1535
1557
Expect (err ).NotTo (HaveOccurred ())
1536
- cl .RegisterVolume (name , VolumeInfo {VolumeID : vol .GetVolume ().GetVolumeId (), NodeID : nid .GetNodeId ()})
1558
+ cl .RegisterVolume (name , VolumeInfo {VolumeID : vol .GetVolume ().GetVolumeId (), NodeID : ni .GetNodeId ()})
1537
1559
Expect (conpubvol ).NotTo (BeNil ())
1538
1560
1539
1561
// ControllerUnpublishVolume
@@ -1544,7 +1566,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
1544
1566
& csi.ControllerUnpublishVolumeRequest {
1545
1567
VolumeId : vol .GetVolume ().GetVolumeId (),
1546
1568
// NodeID is optional in ControllerUnpublishVolume
1547
- NodeId : nid .GetNodeId (),
1569
+ NodeId : ni .GetNodeId (),
1548
1570
Secrets : sc .Secrets .ControllerUnpublishVolumeSecret ,
1549
1571
},
1550
1572
)
0 commit comments