Merge pull request #17526 from danishprakash/fix-kube-secret

kube: rm secret on down, print secret on play
This commit is contained in:
OpenShift Merge Robot
2023-02-22 19:34:18 +01:00
committed by GitHub
4 changed files with 71 additions and 0 deletions

View File

@@ -1688,6 +1688,12 @@ func createAndTestSecret(podmanTest *PodmanTestIntegration, secretYamlString, se
secretList.WaitWithDefaultTimeout()
Expect(secretList).Should(Exit(0))
Expect(secretList.OutputToString()).Should(ContainSubstring(secretName))
// test if secret ID is printed once created
secretListQuiet := podmanTest.Podman([]string{"secret", "list", "--quiet"})
secretListQuiet.WaitWithDefaultTimeout()
Expect(secretListQuiet).Should(Exit(0))
Expect(kube.OutputToString()).Should(ContainSubstring(secretListQuiet.OutputToString()))
}
func deleteAndTestSecret(podmanTest *PodmanTestIntegration, secretName string) {
@@ -3863,6 +3869,31 @@ invalid kube kind
Expect(checkls.OutputToStringArray()).To(BeEmpty())
})
It("podman play kube teardown with secret", func() {
err := writeYaml(secretYaml, kubeYaml)
Expect(err).ToNot(HaveOccurred())
kube := podmanTest.Podman([]string{"kube", "play", kubeYaml})
kube.WaitWithDefaultTimeout()
Expect(kube).Should(Exit(0))
ls := podmanTest.Podman([]string{"secret", "ls", "--format", "{{.ID}}"})
ls.WaitWithDefaultTimeout()
Expect(ls).Should(Exit(0))
Expect(ls.OutputToStringArray()).To(HaveLen(1))
// teardown
teardown := podmanTest.Podman([]string{"kube", "down", kubeYaml})
teardown.WaitWithDefaultTimeout()
Expect(teardown).Should(Exit(0))
Expect(teardown.OutputToString()).Should(ContainSubstring(ls.OutputToString()))
checkls := podmanTest.Podman([]string{"secret", "ls", "--format", "'{{.ID}}'"})
checkls.WaitWithDefaultTimeout()
Expect(checkls).Should(Exit(0))
Expect(checkls.OutputToStringArray()).To(BeEmpty())
})
It("podman play kube teardown pod does not exist", func() {
// teardown
teardown := podmanTest.Podman([]string{"play", "kube", "--down", kubeYaml})