From 478f2da5d6bedf6390be1c0f3928f9ec13894d6d Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 1 Dec 2021 08:19:55 -0700 Subject: e2e tests: a little more minor cleanup sed -i -e 's/Expect(\(.*\)\[\(\".*\"\)\])\.To(Equal(/Expect(\1).To(HaveKeyWithValue(\2, /' test/e2e/*_test.go ...with two manual tweaks, because this converted: Expect(foo["bar"]).To(Equal("")) -> Expect(foo).To(HaveKeyWithValue("bar","")) It looks like the intention of the test was, instead: ...To(Not(HaveKey("bar"))) Signed-off-by: Ed Santiago --- test/e2e/image_scp_test.go | 2 +- test/e2e/play_build_test.go | 12 ++++++------ test/e2e/run_test.go | 6 +++--- test/e2e/trust_test.go | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/e2e/image_scp_test.go b/test/e2e/image_scp_test.go index 6c6c85bc3..6651a04b5 100644 --- a/test/e2e/image_scp_test.go +++ b/test/e2e/image_scp_test.go @@ -109,7 +109,7 @@ var _ = Describe("podman image scp", func() { cfg, err := config.ReadCustomConfig() Expect(err).ShouldNot(HaveOccurred()) Expect(cfg.Engine.ActiveService).To(Equal("QA")) - Expect(cfg.Engine.ServiceDestinations["QA"]).To(Equal( + Expect(cfg.Engine.ServiceDestinations).To(HaveKeyWithValue("QA", config.Destination{ URI: "ssh://root@server.fubar.com:2222/run/podman/podman.sock", }, diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go index 9bdf9d06b..a56560634 100644 --- a/test/e2e/play_build_test.go +++ b/test/e2e/play_build_test.go @@ -125,7 +125,7 @@ LABEL marge=mom Expect(inspect).Should(Exit(0)) inspectData := inspect.InspectContainerToJSON() Expect(len(inspectData)).To(BeNumerically(">", 0)) - Expect(inspectData[0].Config.Labels["homer"]).To(Equal("dad")) + Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad")) }) It("Check that image is built using Containerfile", func() { @@ -162,7 +162,7 @@ LABEL marge=mom Expect(inspect).Should(Exit(0)) inspectData := inspect.InspectContainerToJSON() Expect(len(inspectData)).To(BeNumerically(">", 0)) - Expect(inspectData[0].Config.Labels["homer"]).To(Equal("dad")) + Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad")) }) It("Do not build image if already in the local store", func() { @@ -208,8 +208,8 @@ LABEL marge=mom Expect(inspect).Should(Exit(0)) inspectData := inspect.InspectContainerToJSON() Expect(len(inspectData)).To(BeNumerically(">", 0)) - Expect(inspectData[0].Config.Labels["homer"]).To(Equal("")) - Expect(inspectData[0].Config.Labels["marge"]).To(Equal("mom")) + Expect(inspectData[0].Config.Labels).To(Not(HaveKey("homer"))) + Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("marge", "mom")) }) It("--build should override image in store", func() { @@ -255,8 +255,8 @@ LABEL marge=mom Expect(inspect).Should(Exit(0)) inspectData := inspect.InspectContainerToJSON() Expect(len(inspectData)).To(BeNumerically(">", 0)) - Expect(inspectData[0].Config.Labels["homer"]).To(Equal("dad")) - Expect(inspectData[0].Config.Labels["marge"]).To(Equal("")) + Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("homer", "dad")) + Expect(inspectData[0].Config.Labels).To(Not(HaveKey("marge"))) }) }) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 3d4c1240e..5a08a39f7 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -289,7 +289,7 @@ var _ = Describe("Podman run", func() { Expect(result).Should(Exit(0)) conData := result.InspectContainerToJSON() Expect(conData[0].Path).To(Equal("/dev/init")) - Expect(conData[0].Config.Annotations["io.podman.annotations.init"]).To(Equal("TRUE")) + Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "TRUE")) }) It("podman run a container with --init and --init-path", func() { @@ -301,7 +301,7 @@ var _ = Describe("Podman run", func() { Expect(result).Should(Exit(0)) conData := result.InspectContainerToJSON() Expect(conData[0].Path).To(Equal("/dev/init")) - Expect(conData[0].Config.Annotations["io.podman.annotations.init"]).To(Equal("TRUE")) + Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "TRUE")) }) It("podman run a container without --init", func() { @@ -313,7 +313,7 @@ var _ = Describe("Podman run", func() { Expect(result).Should(Exit(0)) conData := result.InspectContainerToJSON() Expect(conData[0].Path).To(Equal("ls")) - Expect(conData[0].Config.Annotations["io.podman.annotations.init"]).To(Equal("FALSE")) + Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "FALSE")) }) forbidGetCWDSeccompProfile := func() string { diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go index 9a0d57d7a..e02bfa7f2 100644 --- a/test/e2e/trust_test.go +++ b/test/e2e/trust_test.go @@ -69,7 +69,7 @@ var _ = Describe("Podman trust", func() { if err != nil { os.Exit(1) } - Expect(teststruct["default"][0]["type"]).To(Equal("insecureAcceptAnything")) + Expect(teststruct["default"][0]).To(HaveKeyWithValue("type", "insecureAcceptAnything")) }) It("podman image trust show --json", func() { -- cgit v1.2.3-54-g00ecf