From 79d26997a255cb8a4b9800a8c78ec98c98665f8b Mon Sep 17 00:00:00 2001 From: jayunit100 Date: Sun, 26 Apr 2015 18:54:10 -0400 Subject: [PATCH 1/2] E2E: FIX util.go testContainerOutputInNamespace to properly check the namespace. --- test/e2e/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/util.go b/test/e2e/util.go index 75458408c8..47e4c94af7 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -86,7 +86,7 @@ func waitForPodCondition(c *client.Client, ns, podName, desc string, condition p for start := time.Now(); time.Since(start) < podStartTimeout; time.Sleep(5 * time.Second) { pod, err := c.Pods(ns).Get(podName) if err != nil { - Logf("Get pod failed, ignoring for 5s: %v", err) + Logf("Get pod %v in ns %v failed, ignoring for 5s: %v", podName, ns, err) continue } done, err := condition(pod) @@ -367,7 +367,7 @@ func testContainerOutputInNamespace(ns, scenarioName string, c *client.Client, p containerName := pod.Spec.Containers[0].Name // Wait for client pod to complete. - expectNoError(waitForPodSuccess(c, pod.Name, containerName)) + expectNoError(waitForPodSuccessInNamespace(c, pod.Name, containerName, ns)) // Grab its logs. Get host first. podStatus, err := c.Pods(ns).Get(pod.Name) From 9b5e923d1d6dca70f379846dfaa6ec85797f4ebb Mon Sep 17 00:00:00 2001 From: jayunit100 Date: Sun, 26 Apr 2015 18:54:39 -0400 Subject: [PATCH 2/2] E2E: Update docker_containers test to use isolated namespaces using the proper idiom --- test/e2e/docker_containers.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/e2e/docker_containers.go b/test/e2e/docker_containers.go index bf70f1867e..50f4e442f7 100644 --- a/test/e2e/docker_containers.go +++ b/test/e2e/docker_containers.go @@ -27,15 +27,24 @@ import ( var _ = Describe("Docker Containers", func() { var c *client.Client + var ns string BeforeEach(func() { var err error c, err = loadClient() + ns_, err := createTestingNS("containers", c) + ns = ns_.Name Expect(err).NotTo(HaveOccurred()) }) + AfterEach(func() { + if err := c.Namespaces().Delete(ns); err != nil { + Failf("Couldn't delete ns %s", err) + } + }) + It("should use the image defaults if command and args are blank", func() { - testContainerOutput("use defaults", c, entrypointTestPod(), []string{ + testContainerOutputInNamespace(ns, "use defaults", c, entrypointTestPod(), []string{ "[/ep default arguments]", }) }) @@ -44,7 +53,7 @@ var _ = Describe("Docker Containers", func() { pod := entrypointTestPod() pod.Spec.Containers[0].Args = []string{"override", "arguments"} - testContainerOutput("override arguments", c, pod, []string{ + testContainerOutputInNamespace(ns, "override arguments", c, pod, []string{ "[/ep override arguments]", }) }) @@ -55,7 +64,7 @@ var _ = Describe("Docker Containers", func() { pod := entrypointTestPod() pod.Spec.Containers[0].Command = []string{"/ep-2"} - testContainerOutput("override command", c, pod, []string{ + testContainerOutputInNamespace(ns, "override command", c, pod, []string{ "[/ep-2]", }) }) @@ -65,7 +74,7 @@ var _ = Describe("Docker Containers", func() { pod.Spec.Containers[0].Command = []string{"/ep-2"} pod.Spec.Containers[0].Args = []string{"override", "arguments"} - testContainerOutput("override all", c, pod, []string{ + testContainerOutputInNamespace(ns, "override all", c, pod, []string{ "[/ep-2 override arguments]", }) })