topgun/k8s: refactors
@@ -92,6 +92,7 @@ var _ = Describe("Kubernetes credential management", func() {
fly.Run("unpause-pipeline", "-p", "pipeline")
})
+ Context("using the default namespace created by the chart", func() {
It("Gets credentials set by consuming k8s secrets", func() {
session := fly.Start("trigger-job", "-j", "pipeline/unit", "-w")
Wait(session)
@@ -101,29 +102,13 @@ var _ = Describe("Kubernetes credential management", func() {
})
})
- Context("consuming creds from pre-created namespace for a team", func() {
+ Context("using a user-provided namespace", func() {
BeforeEach(func() {
Run(nil, "kubectl", "create", "namespace", releaseName+"-main")
extraArgs = []string{
"--set=concourse.web.kubernetes.createTeamNamespaces=false",
}
})
- JustBeforeEach(func() {
- // ((foo)) --> bar
- createCredentialSecret(releaseName, "foo", "main", map[string]string{"value": "bar"})
-
- // ((caz.baz)) --> zaz
- createCredentialSecret(releaseName, "caz", "main", map[string]string{"baz": "zaz"})
-
- fly.Run("set-pipeline", "-n", "-c", "../pipelines/minimal-credential-management.yml", "-p", "pipeline")
- session := fly.Start("get-pipeline", "-p", "pipeline")
- Wait(session)
-
- Expect(string(session.Out.Contents())).ToNot(ContainSubstring("bar"))
- Expect(string(session.Out.Contents())).ToNot(ContainSubstring("zaz"))
-
- fly.Run("unpause-pipeline", "-p", "pipeline")
- })
It("Gets credentials set by consuming k8s secrets", func() {
session := fly.Start("trigger-job", "-j", "pipeline/unit", "-w")
@@ -137,16 +122,16 @@ var _ = Describe("Kubernetes credential management", func() {
Run(nil, "kubectl", "delete", "namespace", releaseName+"-main", "--wait=false")
})
})
+ })
AfterEach(func() {
helmDestroy(releaseName)
Wait(proxySession.Interrupt())
- Run(nil, "kubectl", "delete", "namespace", namespace, "--wait=false")
+ Run(nil, "kubectl", "delete", "namespace", namespace)
})
})
-
func createCredentialSecret(releaseName, secretName, team string, kv map[string]string) {
args := []string{
"create",
