diff options
author | Ed Santiago <santiago@redhat.com> | 2021-11-30 13:14:56 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2021-11-30 15:19:57 -0700 |
commit | 9ce7ade8c8dedb6a082614e45aa10d0e37c725cc (patch) | |
tree | aeefee1ec3a9bac7ee92c7d8d88f3d85c1364cef /test/e2e/create_test.go | |
parent | 295a6f7dd086731448a1168a349f62d3035258ca (diff) | |
download | podman-9ce7ade8c8dedb6a082614e45aa10d0e37c725cc.tar.gz podman-9ce7ade8c8dedb6a082614e45aa10d0e37c725cc.tar.bz2 podman-9ce7ade8c8dedb6a082614e45aa10d0e37c725cc.zip |
e2e: yet more cleanup of BeTrue/BeFalse
Thanks to Paul for teaching me about HaveKey()
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e/create_test.go')
-rw-r--r-- | test/e2e/create_test.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 52d439f4a..321361382 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -107,9 +107,7 @@ var _ = Describe("Podman create", func() { check := podmanTest.Podman([]string{"inspect", "annotate_test"}) check.WaitWithDefaultTimeout() data := check.InspectContainerToJSON() - value, ok := data[0].Config.Annotations["HELLO"] - Expect(ok).To(BeTrue(), ".Config.Annotations[HELLO]") - Expect(value).To(Equal("WORLD")) + Expect(data[0].Config.Annotations).To(HaveKeyWithValue("HELLO", "WORLD")) }) It("podman create --entrypoint command", func() { @@ -386,10 +384,8 @@ var _ = Describe("Podman create", func() { data := inspect.InspectContainerToJSON() Expect(len(data)).To(Equal(1), "len(InspectContainerToJSON)") Expect(len(data[0].Config.Labels)).To(Equal(2)) - _, ok1 := data[0].Config.Labels["TESTKEY1"] - Expect(ok1).To(BeTrue(), ".Config.Labels[TESTKEY1]") - _, ok2 := data[0].Config.Labels["TESTKEY2"] - Expect(ok2).To(BeTrue(), ".Config.Labels[TESTKEY2]") + Expect(data[0].Config.Labels).To(HaveKey("TESTKEY1")) + Expect(data[0].Config.Labels).To(HaveKey("TESTKEY2")) }) It("podman create with set label", func() { @@ -404,12 +400,8 @@ var _ = Describe("Podman create", func() { data := inspect.InspectContainerToJSON() Expect(len(data)).To(Equal(1)) Expect(len(data[0].Config.Labels)).To(Equal(2)) - val1, ok1 := data[0].Config.Labels["TESTKEY1"] - Expect(ok1).To(BeTrue(), ".Config.Labels[TESTKEY1]") - Expect(val1).To(Equal("value1")) - val2, ok2 := data[0].Config.Labels["TESTKEY2"] - Expect(ok2).To(BeTrue(), ".Config.Labels[TESTKEY2]") - Expect(val2).To(Equal("bar")) + Expect(data[0].Config.Labels).To(HaveKeyWithValue("TESTKEY1", "value1")) + Expect(data[0].Config.Labels).To(HaveKeyWithValue("TESTKEY2", "bar")) }) It("podman create with --restart=on-failure:5 parses correctly", func() { |