Skip to content

Commit b8d6514

Browse files
committed
sanity: export several more items
It would be nice to build upon the test set and connection handling that is already done by csi-sanity when including csi-sanity in a custom test suite. The only reason why that wasn't possible is that some of the functionality unnecessarily wasn't marked for exporting. For an example that depends on these changes, see intel/pmem-csi#237.
1 parent 6b8830b commit b8d6514

File tree

5 files changed

+56
-56
lines changed

5 files changed

+56
-56
lines changed

pkg/sanity/cleanup.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (cl *Cleanup) DeleteVolumes() {
8888
ctx,
8989
&csi.NodeUnpublishVolumeRequest{
9090
VolumeId: info.VolumeID,
91-
TargetPath: cl.Context.targetPath,
91+
TargetPath: cl.Context.TargetPath,
9292
},
9393
); err != nil {
9494
logger.Printf("warning: NodeUnpublishVolume: %s", err)
@@ -99,7 +99,7 @@ func (cl *Cleanup) DeleteVolumes() {
9999
ctx,
100100
&csi.NodeUnstageVolumeRequest{
101101
VolumeId: info.VolumeID,
102-
StagingTargetPath: cl.Context.stagingPath,
102+
StagingTargetPath: cl.Context.StagingPath,
103103
},
104104
); err != nil {
105105
logger.Printf("warning: NodeUnstageVolume: %s", err)

pkg/sanity/controller.go

+21-21
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
379379
})
380380

381381
It("should fail when no volume capabilities are provided", func() {
382-
name := uniqueString("sanity-controller-create-no-volume-capabilities")
382+
name := UniqueString("sanity-controller-create-no-volume-capabilities")
383383
vol, err := c.CreateVolume(
384384
context.Background(),
385385
&csi.CreateVolumeRequest{
@@ -399,7 +399,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
399399
It("should return appropriate values SingleNodeWriter NoCapacity Type:Mount", func() {
400400

401401
By("creating a volume")
402-
name := uniqueString("sanity-controller-create-single-no-capacity")
402+
name := UniqueString("sanity-controller-create-single-no-capacity")
403403

404404
vol, err := c.CreateVolume(
405405
context.Background(),
@@ -441,7 +441,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
441441
It("should return appropriate values SingleNodeWriter WithCapacity 1Gi Type:Mount", func() {
442442

443443
By("creating a volume")
444-
name := uniqueString("sanity-controller-create-single-with-capacity")
444+
name := UniqueString("sanity-controller-create-single-with-capacity")
445445

446446
vol, err := c.CreateVolume(
447447
context.Background(),
@@ -490,7 +490,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
490490
It("should not fail when requesting to create a volume with already existing name and same capacity.", func() {
491491

492492
By("creating a volume")
493-
name := uniqueString("sanity-controller-create-twice")
493+
name := UniqueString("sanity-controller-create-twice")
494494
size := TestVolumeSize(sc)
495495

496496
vol1, err := c.CreateVolume(
@@ -564,7 +564,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
564564
It("should fail when requesting to create a volume with already existing name and different capacity.", func() {
565565

566566
By("creating a volume")
567-
name := uniqueString("sanity-controller-create-twice-different")
567+
name := UniqueString("sanity-controller-create-twice-different")
568568
size1 := TestVolumeSize(sc)
569569

570570
vol1, err := c.CreateVolume(
@@ -693,21 +693,21 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
693693
}
694694

695695
By("creating a volume")
696-
vol1Name := uniqueString("sanity-controller-source-vol")
696+
vol1Name := UniqueString("sanity-controller-source-vol")
697697
vol1Req := MakeCreateVolumeReq(sc, vol1Name)
698698
volume1, err := c.CreateVolume(context.Background(), vol1Req)
699699
Expect(err).NotTo(HaveOccurred())
700700

701701
By("creating a snapshot")
702-
snapName := uniqueString("sanity-controller-snap-from-vol")
702+
snapName := UniqueString("sanity-controller-snap-from-vol")
703703
snapReq := MakeCreateSnapshotReq(sc, snapName, volume1.GetVolume().GetVolumeId(), nil)
704704
snap, err := c.CreateSnapshot(context.Background(), snapReq)
705705
Expect(err).NotTo(HaveOccurred())
706706
Expect(snap).NotTo(BeNil())
707707
verifySnapshotInfo(snap.GetSnapshot())
708708

709709
By("creating a volume from source snapshot")
710-
vol2Name := uniqueString("sanity-controller-vol-from-snap")
710+
vol2Name := UniqueString("sanity-controller-vol-from-snap")
711711
vol2Req := MakeCreateVolumeReq(sc, vol2Name)
712712
vol2Req.VolumeContentSource = &csi.VolumeContentSource{
713713
Type: &csi.VolumeContentSource_Snapshot{
@@ -741,7 +741,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
741741
}
742742

743743
By("creating a volume from source snapshot")
744-
volName := uniqueString("sanity-controller-vol-from-snap")
744+
volName := UniqueString("sanity-controller-vol-from-snap")
745745
volReq := MakeCreateVolumeReq(sc, volName)
746746
volReq.VolumeContentSource = &csi.VolumeContentSource{
747747
Type: &csi.VolumeContentSource_Snapshot{
@@ -763,13 +763,13 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
763763
}
764764

765765
By("creating a volume")
766-
vol1Name := uniqueString("sanity-controller-source-vol")
766+
vol1Name := UniqueString("sanity-controller-source-vol")
767767
vol1Req := MakeCreateVolumeReq(sc, vol1Name)
768768
volume1, err := c.CreateVolume(context.Background(), vol1Req)
769769
Expect(err).NotTo(HaveOccurred())
770770

771771
By("creating a volume from source volume")
772-
vol2Name := uniqueString("sanity-controller-vol-from-vol")
772+
vol2Name := UniqueString("sanity-controller-vol-from-vol")
773773
vol2Req := MakeCreateVolumeReq(sc, vol2Name)
774774
vol2Req.VolumeContentSource = &csi.VolumeContentSource{
775775
Type: &csi.VolumeContentSource_Volume{
@@ -798,7 +798,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
798798
}
799799

800800
By("creating a volume from source snapshot")
801-
volName := uniqueString("sanity-controller-vol-from-snap")
801+
volName := UniqueString("sanity-controller-vol-from-snap")
802802
volReq := MakeCreateVolumeReq(sc, volName)
803803
volReq.VolumeContentSource = &csi.VolumeContentSource{
804804
Type: &csi.VolumeContentSource_Volume{
@@ -853,7 +853,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
853853

854854
// Create Volume First
855855
By("creating a volume")
856-
name := uniqueString("sanity-controller-create-appropriate")
856+
name := UniqueString("sanity-controller-create-appropriate")
857857

858858
vol, err := c.CreateVolume(
859859
context.Background(),
@@ -913,7 +913,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
913913

914914
// Create Volume First
915915
By("creating a single node writer volume")
916-
name := uniqueString("sanity-controller-validate-nocaps")
916+
name := UniqueString("sanity-controller-validate-nocaps")
917917

918918
vol, err := c.CreateVolume(
919919
context.Background(),
@@ -968,7 +968,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
968968

969969
// Create Volume First
970970
By("creating a single node writer volume")
971-
name := uniqueString("sanity-controller-validate")
971+
name := UniqueString("sanity-controller-validate")
972972

973973
vol, err := c.CreateVolume(
974974
context.Background(),
@@ -1120,7 +1120,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
11201120

11211121
// Create Volume First
11221122
By("creating a single node writer volume")
1123-
name := uniqueString("sanity-controller-publish")
1123+
name := UniqueString("sanity-controller-publish")
11241124

11251125
vol, err := c.CreateVolume(
11261126
context.Background(),
@@ -1228,14 +1228,14 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
12281228
createdVols := map[string]string{}
12291229
By("creating volumes")
12301230
for i := int64(0); i < nodeInfo.MaxVolumesPerNode; i++ {
1231-
name := uniqueString(fmt.Sprintf("sanity-max-attach-limit-vol-%d", i))
1231+
name := UniqueString(fmt.Sprintf("sanity-max-attach-limit-vol-%d", i))
12321232
volID, err := CreateAndControllerPublishVolume(sc, c, name, nid)
12331233
Expect(err).NotTo(HaveOccurred())
12341234
cl.RegisterVolume(name, VolumeInfo{VolumeID: volID, NodeID: nid})
12351235
createdVols[name] = volID
12361236
}
12371237

1238-
extraVolName := uniqueString("sanity-max-attach-limit-vol+1")
1238+
extraVolName := UniqueString("sanity-max-attach-limit-vol+1")
12391239
_, err = CreateAndControllerPublishVolume(sc, c, extraVolName, nid)
12401240
Expect(err).To(HaveOccurred())
12411241

@@ -1280,7 +1280,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
12801280

12811281
// Create Volume First
12821282
By("creating a single node writer volume")
1283-
name := uniqueString("sanity-controller-wrong-node")
1283+
name := UniqueString("sanity-controller-wrong-node")
12841284

12851285
vol, err := c.CreateVolume(
12861286
context.Background(),
@@ -1353,7 +1353,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
13531353

13541354
// Create Volume First
13551355
By("creating a single node writer volume")
1356-
name := uniqueString("sanity-controller-published-incompatible")
1356+
name := UniqueString("sanity-controller-published-incompatible")
13571357

13581358
vol, err := c.CreateVolume(
13591359
context.Background(),
@@ -1475,7 +1475,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
14751475

14761476
// Create Volume First
14771477
By("creating a single node writer volume")
1478-
name := uniqueString("sanity-controller-unpublish")
1478+
name := UniqueString("sanity-controller-unpublish")
14791479

14801480
vol, err := c.CreateVolume(
14811481
context.Background(),

pkg/sanity/node.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
187187
context.Background(),
188188
&csi.NodePublishVolumeRequest{
189189
VolumeId: "id",
190-
TargetPath: sc.targetPath + "/target",
190+
TargetPath: sc.TargetPath + "/target",
191191
Secrets: sc.Secrets.NodePublishVolumeSecret,
192192
},
193193
)
@@ -244,7 +244,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
244244
_, err := c.NodeStageVolume(
245245
context.Background(),
246246
&csi.NodeStageVolumeRequest{
247-
StagingTargetPath: sc.stagingPath,
247+
StagingTargetPath: sc.StagingPath,
248248
VolumeCapability: &csi.VolumeCapability{
249249
AccessType: &csi.VolumeCapability_Mount{
250250
Mount: &csi.VolumeCapability_MountVolume{},
@@ -296,7 +296,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
296296

297297
// Create Volume First
298298
By("creating a single node writer volume")
299-
name := uniqueString("sanity-node-stage-nocaps")
299+
name := UniqueString("sanity-node-stage-nocaps")
300300

301301
vol, err := s.CreateVolume(
302302
context.Background(),
@@ -326,7 +326,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
326326
context.Background(),
327327
&csi.NodeStageVolumeRequest{
328328
VolumeId: vol.GetVolume().GetVolumeId(),
329-
StagingTargetPath: sc.stagingPath,
329+
StagingTargetPath: sc.StagingPath,
330330
PublishContext: map[string]string{
331331
"device": device,
332332
},
@@ -365,7 +365,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
365365
_, err := c.NodeUnstageVolume(
366366
context.Background(),
367367
&csi.NodeUnstageVolumeRequest{
368-
StagingTargetPath: sc.stagingPath,
368+
StagingTargetPath: sc.StagingPath,
369369
})
370370
Expect(err).To(HaveOccurred())
371371

@@ -440,7 +440,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
440440
})
441441

442442
It("should fail when volume does not exist on the specified path", func() {
443-
name := uniqueString("sanity-node-get-volume-stats")
443+
name := UniqueString("sanity-node-get-volume-stats")
444444

445445
By("creating a single node writer volume")
446446
vol, err := s.CreateVolume(
@@ -516,7 +516,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
516516
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
517517
},
518518
},
519-
StagingTargetPath: sc.stagingPath,
519+
StagingTargetPath: sc.StagingPath,
520520
VolumeContext: vol.GetVolume().GetVolumeContext(),
521521
PublishContext: conpubvol.GetPublishContext(),
522522
Secrets: sc.Secrets.NodeStageVolumeSecret,
@@ -529,13 +529,13 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
529529
By("publishing the volume on a node")
530530
var stagingPath string
531531
if nodeStageSupported {
532-
stagingPath = sc.stagingPath
532+
stagingPath = sc.StagingPath
533533
}
534534
nodepubvol, err := c.NodePublishVolume(
535535
context.Background(),
536536
&csi.NodePublishVolumeRequest{
537537
VolumeId: vol.GetVolume().GetVolumeId(),
538-
TargetPath: sc.targetPath + "/target",
538+
TargetPath: sc.TargetPath + "/target",
539539
StagingTargetPath: stagingPath,
540540
VolumeCapability: &csi.VolumeCapability{
541541
AccessType: &csi.VolumeCapability_Mount{
@@ -574,7 +574,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
574574
context.Background(),
575575
&csi.NodeUnpublishVolumeRequest{
576576
VolumeId: vol.GetVolume().GetVolumeId(),
577-
TargetPath: sc.targetPath + "/target",
577+
TargetPath: sc.TargetPath + "/target",
578578
})
579579
Expect(err).NotTo(HaveOccurred())
580580
Expect(nodeunpubvol).NotTo(BeNil())
@@ -585,7 +585,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
585585
context.Background(),
586586
&csi.NodeUnstageVolumeRequest{
587587
VolumeId: vol.GetVolume().GetVolumeId(),
588-
StagingTargetPath: sc.stagingPath,
588+
StagingTargetPath: sc.StagingPath,
589589
},
590590
)
591591
Expect(err).NotTo(HaveOccurred())
@@ -623,7 +623,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
623623
})
624624

625625
It("should work", func() {
626-
name := uniqueString("sanity-node-full")
626+
name := UniqueString("sanity-node-full")
627627

628628
// Create Volume First
629629
By("creating a single node writer volume")
@@ -700,7 +700,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
700700
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
701701
},
702702
},
703-
StagingTargetPath: sc.stagingPath,
703+
StagingTargetPath: sc.StagingPath,
704704
VolumeContext: vol.GetVolume().GetVolumeContext(),
705705
PublishContext: conpubvol.GetPublishContext(),
706706
Secrets: sc.Secrets.NodeStageVolumeSecret,
@@ -713,13 +713,13 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
713713
By("publishing the volume on a node")
714714
var stagingPath string
715715
if nodeStageSupported {
716-
stagingPath = sc.stagingPath
716+
stagingPath = sc.StagingPath
717717
}
718718
nodepubvol, err := c.NodePublishVolume(
719719
context.Background(),
720720
&csi.NodePublishVolumeRequest{
721721
VolumeId: vol.GetVolume().GetVolumeId(),
722-
TargetPath: sc.targetPath + "/target",
722+
TargetPath: sc.TargetPath + "/target",
723723
StagingTargetPath: stagingPath,
724724
VolumeCapability: &csi.VolumeCapability{
725725
AccessType: &csi.VolumeCapability_Mount{
@@ -744,7 +744,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
744744
context.Background(),
745745
&csi.NodeGetVolumeStatsRequest{
746746
VolumeId: vol.GetVolume().GetVolumeId(),
747-
VolumePath: sc.targetPath + "/target",
747+
VolumePath: sc.TargetPath + "/target",
748748
},
749749
)
750750
Expect(err).ToNot(HaveOccurred())
@@ -757,7 +757,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
757757
context.Background(),
758758
&csi.NodeUnpublishVolumeRequest{
759759
VolumeId: vol.GetVolume().GetVolumeId(),
760-
TargetPath: sc.targetPath + "/target",
760+
TargetPath: sc.TargetPath + "/target",
761761
})
762762
Expect(err).NotTo(HaveOccurred())
763763
Expect(nodeunpubvol).NotTo(BeNil())
@@ -768,7 +768,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
768768
context.Background(),
769769
&csi.NodeUnstageVolumeRequest{
770770
VolumeId: vol.GetVolume().GetVolumeId(),
771-
StagingTargetPath: sc.stagingPath,
771+
StagingTargetPath: sc.StagingPath,
772772
},
773773
)
774774
Expect(err).NotTo(HaveOccurred())

0 commit comments

Comments
 (0)