Migrate tests to non-default namespaces

This commit is contained in:
Wojciech Tyczynski
2015-07-09 13:56:19 +02:00
parent 4fa9fc7fbf
commit 959477463f
8 changed files with 71 additions and 164 deletions

View File

@@ -20,34 +20,13 @@ import (
"fmt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Downward API", func() {
var c *client.Client
var ns string
BeforeEach(func() {
var err error
c, err = loadClient()
Expect(err).NotTo(HaveOccurred())
ns_, err := createTestingNS("downward-api", c)
ns = ns_.Name
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
// Clean up the namespace if a non-default one was used
if ns != api.NamespaceDefault {
By("Cleaning up the namespace")
err := c.Namespaces().Delete(ns)
expectNoError(err)
}
})
framework := NewFramework("downward-api")
It("should provide pod name and namespace as env vars", func() {
podName := "downward-api-" + string(util.NewUUID())
@@ -88,9 +67,9 @@ var _ = Describe("Downward API", func() {
},
}
testContainerOutputInNamespace("downward api env vars", c, pod, 0, []string{
framework.TestContainerOutput("downward api env vars", pod, 0, []string{
fmt.Sprintf("POD_NAME=%v", podName),
fmt.Sprintf("POD_NAMESPACE=%v", ns),
}, ns)
fmt.Sprintf("POD_NAMESPACE=%v", framework.Namespace.Name),
})
})
})