diff options
author | Ed Santiago <santiago@redhat.com> | 2021-12-01 08:49:55 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2021-12-02 07:54:53 -0700 |
commit | c0a8814fb4d55a950ebf2b2c48731ac939318d7e (patch) | |
tree | de7c1c548a5b9486333fe6417bbb659d28dbec33 /test/e2e/run_networking_test.go | |
parent | 92f9e117670bb060307aadbd6bdeee303923091c (diff) | |
download | podman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.tar.gz podman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.tar.bz2 podman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.zip |
Use HaveLen(x) instead of Expect(len(y)).To(Equal(x))
sed -i -e 's/Expect(len(\(.*\)))\.To(Equal(\(.*\)))/Expect(\1).To(HaveLen(\2))/' test/e2e/*.go
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e/run_networking_test.go')
-rw-r--r-- | test/e2e/run_networking_test.go | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index d73bd43a7..00db9b727 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -91,9 +91,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "80", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80"))) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) }) @@ -103,18 +103,18 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "80-82", "-p", "8090:8090", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(4)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80"))) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["81/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostPort).To(Not(Equal("81"))) Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["82/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0].HostPort).To(Not(Equal("82"))) Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["8090/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0].HostPort).To(Equal("8090")) Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0].HostIP).To(Equal("")) }) @@ -124,18 +124,18 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "80-81", "-p", "8180-8181", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(4)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80"))) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["81/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostPort).To(Not(Equal("81"))) Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["8180/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0].HostPort).To(Not(Equal("8180"))) Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["8181/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostPort).To(Not(Equal("8181"))) Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostIP).To(Equal("")) }) @@ -145,18 +145,18 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "80", "-p", "8280-8282:8280-8282", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(4)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(4)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80"))) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["8280/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0].HostPort).To(Equal("8280")) Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["8281/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0].HostPort).To(Equal("8281")) Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0].HostIP).To(Equal("")) - Expect(len(inspectOut[0].NetworkSettings.Ports["8282/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0].HostPort).To(Equal("8282")) Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0].HostIP).To(Equal("")) }) @@ -166,9 +166,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "8380:80", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8380")) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) }) @@ -179,10 +179,10 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "8480:80/TCP", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) // "tcp" in lower characters - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8480")) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) }) @@ -192,9 +192,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "80/udp", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Not(Equal("80"))) Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("")) }) @@ -204,9 +204,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1:8580:80", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8580")) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("127.0.0.1")) }) @@ -216,9 +216,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1:8680:80/udp", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8680")) Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("127.0.0.1")) }) @@ -228,9 +228,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "[::1]:8780:80/udp", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8780")) Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("::1")) }) @@ -240,9 +240,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "-p", "[::1]:8880:80/tcp", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8880")) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("::1")) }) @@ -252,9 +252,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "--expose", "80", "-P", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("0"))) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) }) @@ -264,9 +264,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "--expose", "80/udp", "-P", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/udp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Not(Equal("0"))) Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("")) }) @@ -276,9 +276,9 @@ var _ = Describe("Podman run networking", func() { session := podmanTest.Podman([]string{"create", "-t", "--expose", "80", "-p", "80", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80"))) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) }) @@ -297,8 +297,8 @@ EXPOSE 2004-2005/tcp`, ALPINE) inspect := podmanTest.Podman([]string{"inspect", imageName}) inspect.WaitWithDefaultTimeout() image := inspect.InspectImageJSON() - Expect(len(image)).To(Equal(1)) - Expect(len(image[0].Config.ExposedPorts)).To(Equal(3)) + Expect(image).To(HaveLen(1)) + Expect(image[0].Config.ExposedPorts).To(HaveLen(3)) Expect(image[0].Config.ExposedPorts).To(HaveKey("2002/tcp")) Expect(image[0].Config.ExposedPorts).To(HaveKey("2001-2003/tcp")) Expect(image[0].Config.ExposedPorts).To(HaveKey("2004-2005/tcp")) @@ -307,11 +307,11 @@ EXPOSE 2004-2005/tcp`, ALPINE) session := podmanTest.Podman([]string{"create", "--name", containerName, imageName, "true"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(containerName) - Expect(len(inspectOut)).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) // Inspect the network settings with available ports to be mapped to the host // Don't need to verity HostConfig.PortBindings since we used --publish-all - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(5)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(5)) Expect(inspectOut[0].NetworkSettings.Ports).To(HaveKey("2001/tcp")) Expect(inspectOut[0].NetworkSettings.Ports).To(HaveKey("2002/tcp")) Expect(inspectOut[0].NetworkSettings.Ports).To(HaveKey("2003/tcp")) @@ -324,9 +324,9 @@ EXPOSE 2004-2005/tcp`, ALPINE) session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1::8980/udp", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["8980/udp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0].HostPort).To(Not(Equal("8980"))) Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0].HostIP).To(Equal("127.0.0.1")) }) @@ -336,9 +336,9 @@ EXPOSE 2004-2005/tcp`, ALPINE) session := podmanTest.Podman([]string{"create", "-t", "-p", ":8181", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["8181/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostPort).To(Not(Equal("8181"))) Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostIP).To(Equal("")) }) @@ -348,9 +348,9 @@ EXPOSE 2004-2005/tcp`, ALPINE) session := podmanTest.Podman([]string{"create", "-t", "-p", "4444:8080", "-p", "5555:8080", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["8080/tcp"])).To(Equal(2)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"]).To(HaveLen(2)) hp1 := inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostPort hp2 := inspectOut[0].NetworkSettings.Ports["8080/tcp"][1].HostPort @@ -364,9 +364,9 @@ EXPOSE 2004-2005/tcp`, ALPINE) session := podmanTest.Podman([]string{"create", "-t", "-p", "0.0.0.0:9280:80", "--name", name, ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() inspectOut := podmanTest.InspectContainer(name) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"]).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("9280")) Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("")) }) @@ -863,8 +863,8 @@ EXPOSE 2004-2005/tcp`, ALPINE) Expect(ctr).Should(Exit(0)) inspectOut := podmanTest.InspectContainer(ctrName) - Expect(len(inspectOut)).To(Equal(1)) - Expect(len(inspectOut[0].NetworkSettings.Networks)).To(Equal(1)) + Expect(inspectOut).To(HaveLen(1)) + Expect(inspectOut[0].NetworkSettings.Networks).To(HaveLen(1)) Expect(inspectOut[0].NetworkSettings.Networks).To(HaveKey("podman")) }) }) |