Skip to content

Reuse testing api #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/sanity/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (cl *Cleanup) DeleteVolumes() {
ctx,
&csi.NodeUnpublishVolumeRequest{
VolumeId: info.VolumeID,
TargetPath: cl.Context.targetPath,
TargetPath: cl.Context.TargetPath,
},
); err != nil {
logger.Printf("warning: NodeUnpublishVolume: %s", err)
Expand All @@ -99,7 +99,7 @@ func (cl *Cleanup) DeleteVolumes() {
ctx,
&csi.NodeUnstageVolumeRequest{
VolumeId: info.VolumeID,
StagingTargetPath: cl.Context.stagingPath,
StagingTargetPath: cl.Context.StagingPath,
},
); err != nil {
logger.Printf("warning: NodeUnstageVolume: %s", err)
Expand Down
42 changes: 21 additions & 21 deletions pkg/sanity/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ var _ = DescribeSanity("Controller Service", func(sc *SanityContext) {
})

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

vol, err := c.CreateVolume(
context.Background(),
Expand Down
36 changes: 18 additions & 18 deletions pkg/sanity/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
context.Background(),
&csi.NodePublishVolumeRequest{
VolumeId: "id",
TargetPath: sc.targetPath + "/target",
TargetPath: sc.TargetPath + "/target",
Secrets: sc.Secrets.NodePublishVolumeSecret,
},
)
Expand Down Expand Up @@ -244,7 +244,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
_, err := c.NodeStageVolume(
context.Background(),
&csi.NodeStageVolumeRequest{
StagingTargetPath: sc.stagingPath,
StagingTargetPath: sc.StagingPath,
VolumeCapability: &csi.VolumeCapability{
AccessType: &csi.VolumeCapability_Mount{
Mount: &csi.VolumeCapability_MountVolume{},
Expand Down Expand Up @@ -296,7 +296,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {

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

vol, err := s.CreateVolume(
context.Background(),
Expand Down Expand Up @@ -326,7 +326,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
context.Background(),
&csi.NodeStageVolumeRequest{
VolumeId: vol.GetVolume().GetVolumeId(),
StagingTargetPath: sc.stagingPath,
StagingTargetPath: sc.StagingPath,
PublishContext: map[string]string{
"device": device,
},
Expand Down Expand Up @@ -365,7 +365,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
_, err := c.NodeUnstageVolume(
context.Background(),
&csi.NodeUnstageVolumeRequest{
StagingTargetPath: sc.stagingPath,
StagingTargetPath: sc.StagingPath,
})
Expect(err).To(HaveOccurred())

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

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

By("creating a single node writer volume")
vol, err := s.CreateVolume(
Expand Down Expand Up @@ -516,7 +516,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
},
},
StagingTargetPath: sc.stagingPath,
StagingTargetPath: sc.StagingPath,
VolumeContext: vol.GetVolume().GetVolumeContext(),
PublishContext: conpubvol.GetPublishContext(),
Secrets: sc.Secrets.NodeStageVolumeSecret,
Expand All @@ -529,13 +529,13 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
By("publishing the volume on a node")
var stagingPath string
if nodeStageSupported {
stagingPath = sc.stagingPath
stagingPath = sc.StagingPath
}
nodepubvol, err := c.NodePublishVolume(
context.Background(),
&csi.NodePublishVolumeRequest{
VolumeId: vol.GetVolume().GetVolumeId(),
TargetPath: sc.targetPath + "/target",
TargetPath: sc.TargetPath + "/target",
StagingTargetPath: stagingPath,
VolumeCapability: &csi.VolumeCapability{
AccessType: &csi.VolumeCapability_Mount{
Expand Down Expand Up @@ -574,7 +574,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
context.Background(),
&csi.NodeUnpublishVolumeRequest{
VolumeId: vol.GetVolume().GetVolumeId(),
TargetPath: sc.targetPath + "/target",
TargetPath: sc.TargetPath + "/target",
})
Expect(err).NotTo(HaveOccurred())
Expect(nodeunpubvol).NotTo(BeNil())
Expand All @@ -585,7 +585,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
context.Background(),
&csi.NodeUnstageVolumeRequest{
VolumeId: vol.GetVolume().GetVolumeId(),
StagingTargetPath: sc.stagingPath,
StagingTargetPath: sc.StagingPath,
},
)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -623,7 +623,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
})

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

// Create Volume First
By("creating a single node writer volume")
Expand Down Expand Up @@ -700,7 +700,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
},
},
StagingTargetPath: sc.stagingPath,
StagingTargetPath: sc.StagingPath,
VolumeContext: vol.GetVolume().GetVolumeContext(),
PublishContext: conpubvol.GetPublishContext(),
Secrets: sc.Secrets.NodeStageVolumeSecret,
Expand All @@ -713,13 +713,13 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
By("publishing the volume on a node")
var stagingPath string
if nodeStageSupported {
stagingPath = sc.stagingPath
stagingPath = sc.StagingPath
}
nodepubvol, err := c.NodePublishVolume(
context.Background(),
&csi.NodePublishVolumeRequest{
VolumeId: vol.GetVolume().GetVolumeId(),
TargetPath: sc.targetPath + "/target",
TargetPath: sc.TargetPath + "/target",
StagingTargetPath: stagingPath,
VolumeCapability: &csi.VolumeCapability{
AccessType: &csi.VolumeCapability_Mount{
Expand All @@ -744,7 +744,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
context.Background(),
&csi.NodeGetVolumeStatsRequest{
VolumeId: vol.GetVolume().GetVolumeId(),
VolumePath: sc.targetPath + "/target",
VolumePath: sc.TargetPath + "/target",
},
)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -757,7 +757,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
context.Background(),
&csi.NodeUnpublishVolumeRequest{
VolumeId: vol.GetVolume().GetVolumeId(),
TargetPath: sc.targetPath + "/target",
TargetPath: sc.TargetPath + "/target",
})
Expect(err).NotTo(HaveOccurred())
Expect(nodeunpubvol).NotTo(BeNil())
Expand All @@ -768,7 +768,7 @@ var _ = DescribeSanity("Node Service", func(sc *SanityContext) {
context.Background(),
&csi.NodeUnstageVolumeRequest{
VolumeId: vol.GetVolume().GetVolumeId(),
StagingTargetPath: sc.stagingPath,
StagingTargetPath: sc.StagingPath,
},
)
Expect(err).NotTo(HaveOccurred())
Expand Down
Loading