Skip to content

Commit

Permalink
dump namespace object in e2e when it doesn't get deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
deads2k committed Sep 17, 2019
1 parent e7090e8 commit fda9680
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/e2e/framework/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ go_library(
"//test/e2e/system:go_default_library",
"//test/utils:go_default_library",
"//test/utils/image:go_default_library",
"//vendor/github.com/davecgh/go-spew/spew:go_default_library",
"//vendor/github.com/onsi/ginkgo:go_default_library",
"//vendor/github.com/onsi/ginkgo/config:go_default_library",
"//vendor/github.com/onsi/gomega:go_default_library",
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"syscall"
"time"

"github.com/davecgh/go-spew/spew"
"golang.org/x/net/websocket"
"k8s.io/klog"

Expand Down Expand Up @@ -871,8 +872,11 @@ func deleteNS(c clientset.Interface, dynamicClient dynamic.Interface, namespace
}

// wait for namespace to delete or timeout.
var lastNamespace *v1.Namespace
err := wait.PollImmediate(2*time.Second, timeout, func() (bool, error) {
if _, err := c.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{}); err != nil {
var err error
lastNamespace, err = c.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{})
if err != nil {
if apierrs.IsNotFound(err) {
return true, nil
}
Expand Down Expand Up @@ -902,6 +906,9 @@ func deleteNS(c clientset.Interface, dynamicClient dynamic.Interface, namespace

// a timeout waiting for namespace deletion happened!
if err != nil {
// namespaces now have conditions that are useful for debugging generic resources and finalizers
e2elog.Logf("namespace did not cleanup: %s", spew.Sdump(lastNamespace))

// some content remains in the namespace
if remainingContent {
// pods remain
Expand Down

0 comments on commit fda9680

Please sign in to comment.