summaryrefslogtreecommitdiff
path: root/test/e2e/secret_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/secret_test.go')
-rw-r--r--test/e2e/secret_test.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index 661ebbdc0..f08638b1b 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "fmt"
"io/ioutil"
"os"
"path/filepath"
@@ -145,6 +146,54 @@ var _ = Describe("Podman secret", func() {
})
+ It("podman secret ls with filters", func() {
+ secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
+ err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
+ Expect(err).To(BeNil())
+
+ secret1 := "Secret1"
+ secret2 := "Secret2"
+
+ session := podmanTest.Podman([]string{"secret", "create", secret1, secretFilePath})
+ session.WaitWithDefaultTimeout()
+ secrID1 := session.OutputToString()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"secret", "create", secret2, secretFilePath})
+ session.WaitWithDefaultTimeout()
+ secrID2 := session.OutputToString()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"secret", "create", "Secret3", secretFilePath})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ list := podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("name=%s", secret1)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(2), ContainSubstring(secret1))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("name=%s", secret2)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(2), ContainSubstring(secret2))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("id=%s", secrID1)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(2), ContainSubstring(secrID1))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("id=%s", secrID2)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(2), ContainSubstring(secrID2))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--filter", fmt.Sprintf("name=%s,name=%s", secret1, secret2)})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).To(HaveLen(3), ContainSubstring(secret1), ContainSubstring(secret2))
+ })
+
It("podman secret ls with Go template", func() {
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)