Dump namespace if the namespace could not be cleaned up

This commit is contained in:
Tim Schrodi 2019-11-22 12:14:28 +01:00
parent d87c921a51
commit c3c7ea2efd

View File

@ -334,6 +334,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)
}