diff options
author | Ashley Cui <acui@redhat.com> | 2022-09-12 15:52:54 -0400 |
---|---|---|
committer | Ashley Cui <acui@redhat.com> | 2022-09-20 16:28:00 -0400 |
commit | 9bb51e8e96f98ab74d416a9af9bd708c7c503bdf (patch) | |
tree | 602c43271772dd72cd52dca3bfb397f65ee3515e /test/e2e/secret_test.go | |
parent | 8216d0ef4e8212413a650a55ce8fd02f2ca8d181 (diff) | |
download | podman-9bb51e8e96f98ab74d416a9af9bd708c7c503bdf.tar.gz podman-9bb51e8e96f98ab74d416a9af9bd708c7c503bdf.tar.bz2 podman-9bb51e8e96f98ab74d416a9af9bd708c7c503bdf.zip |
Add labels to secrets
Add --label/-l label flag to secret create, and show labels when
inspecting secrets. Also allow labeling secrets via libpod/compat API.
Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'test/e2e/secret_test.go')
-rw-r--r-- | test/e2e/secret_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go index 902f422bd..91135b958 100644 --- a/test/e2e/secret_test.go +++ b/test/e2e/secret_test.go @@ -310,4 +310,41 @@ var _ = Describe("Podman secret", func() { Expect(inspect.OutputToString()).To(Equal(secrID)) }) + It("podman secret with labels", func() { + secretFilePath := filepath.Join(podmanTest.TempDir, "secret") + err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755) + Expect(err).To(BeNil()) + + session := podmanTest.Podman([]string{"secret", "create", "--label", "foo=bar", "a", secretFilePath}) + session.WaitWithDefaultTimeout() + secrID := session.OutputToString() + Expect(session).Should(Exit(0)) + + inspect := podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.Spec.Labels}}", secrID}) + inspect.WaitWithDefaultTimeout() + Expect(inspect).Should(Exit(0)) + Expect(inspect.OutputToString()).To(ContainSubstring("foo:bar")) + + session = podmanTest.Podman([]string{"secret", "create", "--label", "foo=bar", "--label", "a:b", "b", secretFilePath}) + session.WaitWithDefaultTimeout() + secrID = session.OutputToString() + Expect(session).Should(Exit(0)) + + inspect = podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.Spec.Labels}}", secrID}) + inspect.WaitWithDefaultTimeout() + Expect(inspect).Should(Exit(0)) + Expect(inspect.OutputToString()).To(ContainSubstring("foo:bar")) + Expect(inspect.OutputToString()).To(ContainSubstring("a:b")) + + session = podmanTest.Podman([]string{"secret", "create", "c", secretFilePath}) + session.WaitWithDefaultTimeout() + secrID = session.OutputToString() + Expect(session).Should(Exit(0)) + + inspect = podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.Spec.Labels}}", secrID}) + inspect.WaitWithDefaultTimeout() + Expect(inspect).Should(Exit(0)) + Expect(inspect.OutputToString()).To(Equal("map[]")) + + }) }) |