Skip to content
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

Fix subpath e2e tests on multizone cluster. #61111

Merged
merged 1 commit into from Mar 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 16 additions & 8 deletions test/e2e/storage/subpath.go
Expand Up @@ -552,7 +552,7 @@ func (s *emptydirSource) cleanupVolume(f *framework.Framework) {
}

type gcepdSource struct {
diskName string
pvc *v1.PersistentVolumeClaim
}

func initGCEPD() volSource {
Expand All @@ -563,21 +563,29 @@ func initGCEPD() volSource {
func (s *gcepdSource) createVolume(f *framework.Framework) volInfo {
var err error

framework.Logf("Creating GCE PD volume")
s.diskName, err = framework.CreatePDWithRetry()
framework.ExpectNoError(err, "Error creating PD")
framework.Logf("Creating GCE PD volume via dynamic provisioning")
testCase := storageClassTest{
name: "subpath",
claimSize: "2G",
}

pvc := newClaim(testCase, f.Namespace.Name, "subpath")
s.pvc, err = framework.CreatePVC(f.ClientSet, f.Namespace.Name, pvc)
framework.ExpectNoError(err, "Error creating PVC")

return volInfo{
source: &v1.VolumeSource{
GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{PDName: s.diskName},
PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{
ClaimName: s.pvc.Name,
},
},
}
}

func (s *gcepdSource) cleanupVolume(f *framework.Framework) {
if s.diskName != "" {
err := framework.DeletePDWithRetry(s.diskName)
framework.ExpectNoError(err, "Error deleting PD")
if s.pvc != nil {
err := f.ClientSet.CoreV1().PersistentVolumeClaims(f.Namespace.Name).Delete(s.pvc.Name, nil)
framework.ExpectNoError(err, "Error deleting PVC")
}
}

Expand Down