Skip to content

Commit 8e1a754

Browse files
committed
sanity/controller.go: Delete duplicated test sequence
VolumeUnpublish test sequence repeats exactly steps that are already made in VolumePublish, so we can omit the 2nd sequence as it adds no new value.
1 parent 813b587 commit 8e1a754

File tree

1 file changed

+0
-87
lines changed

1 file changed

+0
-87
lines changed

pkg/sanity/controller.go

-87
Original file line numberDiff line numberDiff line change
@@ -1381,93 +1381,6 @@ var _ = DescribeSanity("Controller Service [Controller Server]", func(sc *TestCo
13811381
Expect(ok).To(BeTrue())
13821382
Expect(serverError.Code()).To(Equal(codes.InvalidArgument))
13831383
})
1384-
1385-
// CSI spec poses no specific requirements for the cluster/storage setups that a SP MUST support. To perform
1386-
// meaningful checks the following test assumes that topology-aware provisioning on a single node setup is supported
1387-
It("should return appropriate values (no optional values added)", func() {
1388-
1389-
// Create Volume First
1390-
By("creating a single node writer volume")
1391-
name := UniqueString("sanity-controller-unpublish")
1392-
1393-
By("getting node information")
1394-
ni, err := n.NodeGetInfo(
1395-
context.Background(),
1396-
&csi.NodeGetInfoRequest{})
1397-
Expect(err).NotTo(HaveOccurred())
1398-
Expect(ni).NotTo(BeNil())
1399-
Expect(ni.GetNodeId()).NotTo(BeEmpty())
1400-
1401-
var accReqs *csi.TopologyRequirement
1402-
if ni.AccessibleTopology != nil {
1403-
// Topology requirements are honored if provided by the driver
1404-
accReqs = &csi.TopologyRequirement{
1405-
Requisite: []*csi.Topology{ni.AccessibleTopology},
1406-
}
1407-
}
1408-
1409-
vol, err := c.CreateVolume(
1410-
context.Background(),
1411-
&csi.CreateVolumeRequest{
1412-
Name: name,
1413-
VolumeCapabilities: []*csi.VolumeCapability{
1414-
TestVolumeCapabilityWithAccessType(sc, csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER),
1415-
},
1416-
Secrets: sc.Secrets.CreateVolumeSecret,
1417-
Parameters: sc.Config.TestVolumeParameters,
1418-
AccessibilityRequirements: accReqs,
1419-
},
1420-
)
1421-
Expect(err).NotTo(HaveOccurred())
1422-
Expect(vol).NotTo(BeNil())
1423-
Expect(vol.GetVolume()).NotTo(BeNil())
1424-
Expect(vol.GetVolume().GetVolumeId()).NotTo(BeEmpty())
1425-
cl.RegisterVolume(name, VolumeInfo{VolumeID: vol.GetVolume().GetVolumeId()})
1426-
1427-
// ControllerPublishVolume
1428-
By("calling controllerpublish on that volume")
1429-
1430-
conpubvol, err := c.ControllerPublishVolume(
1431-
context.Background(),
1432-
&csi.ControllerPublishVolumeRequest{
1433-
VolumeId: vol.GetVolume().GetVolumeId(),
1434-
NodeId: ni.GetNodeId(),
1435-
VolumeCapability: TestVolumeCapabilityWithAccessType(sc, csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER),
1436-
Readonly: false,
1437-
Secrets: sc.Secrets.ControllerPublishVolumeSecret,
1438-
},
1439-
)
1440-
Expect(err).NotTo(HaveOccurred())
1441-
cl.RegisterVolume(name, VolumeInfo{VolumeID: vol.GetVolume().GetVolumeId(), NodeID: ni.GetNodeId()})
1442-
Expect(conpubvol).NotTo(BeNil())
1443-
1444-
// ControllerUnpublishVolume
1445-
By("calling controllerunpublish on that volume")
1446-
1447-
conunpubvol, err := c.ControllerUnpublishVolume(
1448-
context.Background(),
1449-
&csi.ControllerUnpublishVolumeRequest{
1450-
VolumeId: vol.GetVolume().GetVolumeId(),
1451-
// NodeID is optional in ControllerUnpublishVolume
1452-
NodeId: ni.GetNodeId(),
1453-
Secrets: sc.Secrets.ControllerUnpublishVolumeSecret,
1454-
},
1455-
)
1456-
Expect(err).NotTo(HaveOccurred())
1457-
Expect(conunpubvol).NotTo(BeNil())
1458-
1459-
By("cleaning up deleting the volume")
1460-
1461-
_, err = c.DeleteVolume(
1462-
context.Background(),
1463-
&csi.DeleteVolumeRequest{
1464-
VolumeId: vol.GetVolume().GetVolumeId(),
1465-
Secrets: sc.Secrets.DeleteVolumeSecret,
1466-
},
1467-
)
1468-
Expect(err).NotTo(HaveOccurred())
1469-
cl.UnregisterVolume(name)
1470-
})
14711384
})
14721385
})
14731386

0 commit comments

Comments
 (0)