e2e test cases should clean up more effectively

Graceful deletion exposes weakness in cleanup paths, add
common hooks for waiting for namespcae deletion to complete,
use direct delection where necessary, and add some debug output
for finding cleanup flags (namespaces that aren't fully deleted)
This commit is contained in:
Clayton Coleman
2015-08-07 12:40:59 -04:00
parent 213e7a8ab6
commit e623d33343
5 changed files with 77 additions and 15 deletions

View File

@@ -62,7 +62,7 @@ var _ = Describe("Services", func() {
AfterEach(func() {
for _, ns := range namespaces {
By(fmt.Sprintf("Destroying namespace %v", ns))
if err := c.Namespaces().Delete(ns); err != nil {
if err := deleteNS(c, ns); err != nil {
Failf("Couldn't delete namespace %s: %s", ns, err)
}
}
@@ -1096,6 +1096,14 @@ func validateEndpointsOrFail(c *client.Client, namespace, serviceName string, ex
}
Logf("Unexpected number of endpoints: found %v, expected %v (%v elapsed, ignoring for 5s)", portsByIp, expectedEndpoints, time.Since(start))
}
if pods, err := c.Pods(api.NamespaceAll).List(labels.Everything(), fields.Everything()); err == nil {
for _, pod := range pods.Items {
Logf("Pod %s\t%s\t%s\t%s", pod.Namespace, pod.Name, pod.Spec.NodeName, pod.DeletionTimestamp)
}
} else {
Logf("Can't list pod debug info: %v", err)
}
Failf("Timed out waiting for service %s in namespace %s to expose endpoints %v (%v elapsed)", serviceName, namespace, expectedEndpoints, serviceStartTimeout)
}