summaryrefslogtreecommitdiff
path: root/test/e2e/create_test.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2022-04-27 14:58:46 -0600
committerEd Santiago <santiago@redhat.com>2022-04-28 05:41:53 -0600
commitb3f38c31b29b51440edd5913a90019efbced0862 (patch)
tree72749f8e3ddedee0bb882c186a7f3cee08fe5f1c /test/e2e/create_test.go
parent2b8cafc0671fbbd155770f044b8216f050877192 (diff)
downloadpodman-b3f38c31b29b51440edd5913a90019efbced0862.tar.gz
podman-b3f38c31b29b51440edd5913a90019efbced0862.tar.bz2
podman-b3f38c31b29b51440edd5913a90019efbced0862.zip
Ginkgo: use HaveField() for better error checking
This is a very late followup to my ginkgo-improving work of 2021. It has been stuck since December because it requires gomega 1.17, which we've just enabled. This commit is simply a copy-paste of a command I saved in my TODO list many months ago: sed -i -e 's/Expect(\([^ ]\+\)\.\([a-zA-Z0-9]\+\))\.To(Equal(/Expect(\1).To(HaveField(\"\2\", /' test/e2e/*_test.go Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e/create_test.go')
-rw-r--r--test/e2e/create_test.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 4c3b5604a..9b1340a2c 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -268,7 +268,7 @@ var _ = Describe("Podman create", func() {
Expect(session).Should(Exit(0))
ctrJSON := podmanTest.InspectContainer(ctrName)
- Expect(podData.ID).To(Equal(ctrJSON[0].Pod)) // Make sure the container's pod matches the pod's ID
+ Expect(podData).To(HaveField("ID", ctrJSON[0].Pod)) // Make sure the container's pod matches the pod's ID
})
It("podman run entrypoint and cmd test", func() {
@@ -281,7 +281,7 @@ var _ = Describe("Podman create", func() {
Expect(ctrJSON).To(HaveLen(1))
Expect(ctrJSON[0].Config.Cmd).To(HaveLen(1))
Expect(ctrJSON[0].Config.Cmd[0]).To(Equal("redis-server"))
- Expect(ctrJSON[0].Config.Entrypoint).To(Equal("docker-entrypoint.sh"))
+ Expect(ctrJSON[0].Config).To(HaveField("Entrypoint", "docker-entrypoint.sh"))
})
It("podman create --pull", func() {
@@ -413,8 +413,8 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].HostConfig.RestartPolicy.Name).To(Equal("on-failure"))
- Expect(data[0].HostConfig.RestartPolicy.MaximumRetryCount).To(Equal(uint(5)))
+ Expect(data[0].HostConfig.RestartPolicy).To(HaveField("Name", "on-failure"))
+ Expect(data[0].HostConfig.RestartPolicy).To(HaveField("MaximumRetryCount", uint(5)))
})
It("podman create with --restart-policy=always:5 fails", func() {
@@ -434,7 +434,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].HostConfig.RestartPolicy.Name).To(Equal(unlessStopped))
+ Expect(data[0].HostConfig.RestartPolicy).To(HaveField("Name", unlessStopped))
})
It("podman create with -m 1000000 sets swap to 2000000", func() {
@@ -448,7 +448,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].HostConfig.MemorySwap).To(Equal(int64(2 * numMem)))
+ Expect(data[0].HostConfig).To(HaveField("MemorySwap", int64(2 * numMem)))
})
It("podman create --cpus 5 sets nanocpus", func() {
@@ -463,7 +463,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].HostConfig.NanoCpus).To(Equal(int64(nanoCPUs)))
+ Expect(data[0].HostConfig).To(HaveField("NanoCpus", int64(nanoCPUs)))
})
It("podman create --replace", func() {
@@ -491,7 +491,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.StopSignal).To(Equal(uint(15)))
+ Expect(data[0].Config).To(HaveField("StopSignal", uint(15)))
})
It("podman create --tz", func() {
@@ -509,7 +509,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Timezone).To(Equal("Pacific/Honolulu"))
+ Expect(data[0].Config).To(HaveField("Timezone", "Pacific/Honolulu"))
session = podmanTest.Podman([]string{"create", "--tz", "local", "--name", "lcl", ALPINE, "date"})
session.WaitWithDefaultTimeout()
@@ -517,7 +517,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Timezone).To(Equal("local"))
+ Expect(data[0].Config).To(HaveField("Timezone", "local"))
})
It("podman create --umask", func() {
@@ -531,7 +531,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data := inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Umask).To(Equal("0022"))
+ Expect(data[0].Config).To(HaveField("Umask", "0022"))
session = podmanTest.Podman([]string{"create", "--umask", "0002", "--name", "umask", ALPINE})
session.WaitWithDefaultTimeout()
@@ -539,7 +539,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Umask).To(Equal("0002"))
+ Expect(data[0].Config).To(HaveField("Umask", "0002"))
session = podmanTest.Podman([]string{"create", "--umask", "0077", "--name", "fedora", fedoraMinimal})
session.WaitWithDefaultTimeout()
@@ -547,7 +547,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Umask).To(Equal("0077"))
+ Expect(data[0].Config).To(HaveField("Umask", "0077"))
session = podmanTest.Podman([]string{"create", "--umask", "22", "--name", "umask-short", ALPINE})
session.WaitWithDefaultTimeout()
@@ -555,7 +555,7 @@ var _ = Describe("Podman create", func() {
inspect.WaitWithDefaultTimeout()
data = inspect.InspectContainerToJSON()
Expect(data).To(HaveLen(1))
- Expect(data[0].Config.Umask).To(Equal("0022"))
+ Expect(data[0].Config).To(HaveField("Umask", "0022"))
session = podmanTest.Podman([]string{"create", "--umask", "9999", "--name", "bad", ALPINE})
session.WaitWithDefaultTimeout()
@@ -689,8 +689,8 @@ var _ = Describe("Podman create", func() {
idata := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(idata).To(HaveLen(1))
- Expect(idata[0].Os).To(Equal(runtime.GOOS))
- Expect(idata[0].Architecture).To(Equal("arm64"))
+ Expect(idata[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(idata[0]).To(HaveField("Architecture", "arm64"))
})
It("podman create --uid/gidmap --pod conflict test", func() {