mirror of https://github.com/k3s-io/k3s
E2E: Update docker_containers test to use isolated namespaces using the proper idiom
parent
79d26997a2
commit
9b5e923d1d
|
@ -27,15 +27,24 @@ import (
|
||||||
|
|
||||||
var _ = Describe("Docker Containers", func() {
|
var _ = Describe("Docker Containers", func() {
|
||||||
var c *client.Client
|
var c *client.Client
|
||||||
|
var ns string
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
var err error
|
var err error
|
||||||
c, err = loadClient()
|
c, err = loadClient()
|
||||||
|
ns_, err := createTestingNS("containers", c)
|
||||||
|
ns = ns_.Name
|
||||||
Expect(err).NotTo(HaveOccurred())
|
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() {
|
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]",
|
"[/ep default arguments]",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -44,7 +53,7 @@ var _ = Describe("Docker Containers", func() {
|
||||||
pod := entrypointTestPod()
|
pod := entrypointTestPod()
|
||||||
pod.Spec.Containers[0].Args = []string{"override", "arguments"}
|
pod.Spec.Containers[0].Args = []string{"override", "arguments"}
|
||||||
|
|
||||||
testContainerOutput("override arguments", c, pod, []string{
|
testContainerOutputInNamespace(ns, "override arguments", c, pod, []string{
|
||||||
"[/ep override arguments]",
|
"[/ep override arguments]",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -55,7 +64,7 @@ var _ = Describe("Docker Containers", func() {
|
||||||
pod := entrypointTestPod()
|
pod := entrypointTestPod()
|
||||||
pod.Spec.Containers[0].Command = []string{"/ep-2"}
|
pod.Spec.Containers[0].Command = []string{"/ep-2"}
|
||||||
|
|
||||||
testContainerOutput("override command", c, pod, []string{
|
testContainerOutputInNamespace(ns, "override command", c, pod, []string{
|
||||||
"[/ep-2]",
|
"[/ep-2]",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -65,7 +74,7 @@ var _ = Describe("Docker Containers", func() {
|
||||||
pod.Spec.Containers[0].Command = []string{"/ep-2"}
|
pod.Spec.Containers[0].Command = []string{"/ep-2"}
|
||||||
pod.Spec.Containers[0].Args = []string{"override", "arguments"}
|
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]",
|
"[/ep-2 override arguments]",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue