Merge pull request #85542 from schrodit/e2e-dump-ns

Dump namespace if the namespace could not be cleaned up
This commit is contained in:
Kubernetes Prow Robot 2019-12-10 16:05:20 -08:00 committed by GitHub
commit 541b4e4b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -332,6 +332,11 @@ func (f *Framework) AfterEach() {
if err := f.ClientSet.CoreV1().Namespaces().Delete(ns.Name, nil); err != nil {
if !apierrors.IsNotFound(err) {
nsDeletionErrors[ns.Name] = err
// Dump namespace if we are unable to delete the namespace and the dump was not already performed.
if !ginkgo.CurrentGinkgoTestDescription().Failed && TestContext.DumpLogsOnFailure {
DumpAllNamespaceInfo(f.ClientSet, ns.Name)
}
} else {
Logf("Namespace %v was already deleted", ns.Name)
}