From 5cc420c4087fb1aefb642456ffd0c885c8e6aee3 Mon Sep 17 00:00:00 2001 From: gmarek Date: Mon, 4 Jan 2016 17:26:24 +0100 Subject: [PATCH] Small cleanup in density e2e test. --- test/e2e/density.go | 20 +------------------- test/e2e/framework.go | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/test/e2e/density.go b/test/e2e/density.go index afec7307877..c90bf570b0c 100644 --- a/test/e2e/density.go +++ b/test/e2e/density.go @@ -118,24 +118,6 @@ var _ = Describe("Density [Skipped]", func() { // Gathers data prior to framework namespace teardown AfterEach(func() { - // Remove any remaining pods from this test if the - // replication controller still exists and the replica count - // isn't 0. This means the controller wasn't cleaned up - // during the test so clean it up here. We want to do it separately - // to not cause a timeout on Namespace removal. - rc, err := c.ReplicationControllers(ns).Get(RCName) - if err == nil && rc.Spec.Replicas != 0 { - By("Cleaning up the replication controller") - err := DeleteRC(c, ns, RCName) - expectNoError(err) - } - - By("Removing additional pods if any") - for i := 1; i <= nodeCount; i++ { - name := additionalPodsPrefix + "-" + strconv.Itoa(i) - c.Pods(ns).Delete(name, nil) - } - // Verify latency metrics. highLatencyRequests, err := HighLatencyRequests(c) expectNoError(err) @@ -148,7 +130,7 @@ var _ = Describe("Density [Skipped]", func() { }) // Explicitly put here, to delete namespace at the end of the test - // (after measuring latency metrics, etc.). + // (after measuring latency metrics, etc.).framework := NewFramework("density") framework := NewFramework("density") framework.NamespaceDeletionTimeout = time.Hour diff --git a/test/e2e/framework.go b/test/e2e/framework.go index a68c9f23a4d..72fd0e4c220 100644 --- a/test/e2e/framework.go +++ b/test/e2e/framework.go @@ -136,20 +136,6 @@ func (f *Framework) afterEach() { Failf("All nodes should be ready after test, %v", err) } - if testContext.DeleteNamespace { - By(fmt.Sprintf("Destroying namespace %q for this suite.", f.Namespace.Name)) - - timeout := 5 * time.Minute - if f.NamespaceDeletionTimeout != 0 { - timeout = f.NamespaceDeletionTimeout - } - if err := deleteNS(f.Client, f.Namespace.Name, timeout); err != nil { - Failf("Couldn't delete ns %q: %s", f.Namespace.Name, err) - } - } else { - Logf("Found DeleteNamespace=false, skipping namespace deletion!") - } - summaries := make([]TestDataSummary, 0) if testContext.GatherKubeSystemResourceUsageData { summaries = append(summaries, f.gatherer.stopAndSummarize([]int{50, 90, 99, 100}, f.addonResourceConstraints)) @@ -176,6 +162,20 @@ func (f *Framework) afterEach() { } } + if testContext.DeleteNamespace { + By(fmt.Sprintf("Destroying namespace %q for this suite.", f.Namespace.Name)) + + timeout := 5 * time.Minute + if f.NamespaceDeletionTimeout != 0 { + timeout = f.NamespaceDeletionTimeout + } + if err := deleteNS(f.Client, f.Namespace.Name, timeout); err != nil { + Failf("Couldn't delete ns %q: %s", f.Namespace.Name, err) + } + } else { + Logf("Found DeleteNamespace=false, skipping namespace deletion!") + } + outputTypes := strings.Split(testContext.OutputPrintType, ",") for _, printType := range outputTypes { switch printType {