Merge pull request #95003 from jsafrane/cinder-delete-preprovisioned

Fail a test on pre-provisioned Cinder volume deletion error
This commit is contained in:
Kubernetes Prow Robot 2020-09-25 14:26:48 -07:00 committed by GitHub
commit d66695653c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1184,6 +1184,7 @@ func (c *cinderDriver) CreateVolume(config *testsuites.PerTestConfig, volType te
}
func (v *cinderVolume) DeleteVolume() {
id := v.volumeID
name := v.volumeName
// Try to delete the volume for several seconds - it takes
@ -1192,16 +1193,23 @@ func (v *cinderVolume) DeleteVolume() {
var err error
timeout := time.Second * 120
framework.Logf("Waiting up to %v for removal of cinder volume %s", timeout, name)
framework.Logf("Waiting up to %v for removal of cinder volume %s / %s", timeout, id, name)
for start := time.Now(); time.Since(start) < timeout; time.Sleep(5 * time.Second) {
output, err = exec.Command("cinder", "delete", name).CombinedOutput()
output, err = exec.Command("cinder", "delete", id).CombinedOutput()
if err == nil {
framework.Logf("Cinder volume %s deleted", name)
framework.Logf("Cinder volume %s deleted", id)
return
}
framework.Logf("Failed to delete volume %s: %v", name, err)
framework.Logf("Failed to delete volume %s / %s: %v\n%s", id, name, err, string(output))
}
framework.Logf("Giving up deleting volume %s: %v\n%s", name, err, string(output[:]))
// Timed out, try to get "cinder show <volume>" output for easier debugging
showOutput, showErr := exec.Command("cinder", "show", id).CombinedOutput()
if showErr != nil {
framework.Logf("Failed to show volume %s / %s: %v\n%s", id, name, showErr, string(showOutput))
} else {
framework.Logf("Volume %s / %s:\n%s", id, name, string(showOutput))
}
framework.Failf("Failed to delete pre-provisioned volume %s / %s: %v\n%s", id, name, err, string(output[:]))
}
// GCE