aboutsummaryrefslogtreecommitdiff
path: root/test
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
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')
-rw-r--r--test/e2e/build_test.go8
-rw-r--r--test/e2e/checkpoint_image_test.go6
-rw-r--r--test/e2e/checkpoint_test.go14
-rw-r--r--test/e2e/commit_test.go6
-rw-r--r--test/e2e/container_clone_test.go14
-rw-r--r--test/e2e/container_create_volume_test.go2
-rw-r--r--test/e2e/create_test.go32
-rw-r--r--test/e2e/generate_kube_test.go54
-rw-r--r--test/e2e/healthcheck_run_test.go22
-rw-r--r--test/e2e/image_scp_test.go2
-rw-r--r--test/e2e/init_test.go12
-rw-r--r--test/e2e/inspect_test.go20
-rw-r--r--test/e2e/network_create_test.go8
-rw-r--r--test/e2e/network_test.go26
-rw-r--r--test/e2e/play_kube_test.go4
-rw-r--r--test/e2e/pod_create_test.go32
-rw-r--r--test/e2e/pod_initcontainers_test.go2
-rw-r--r--test/e2e/pod_inspect_test.go4
-rw-r--r--test/e2e/pull_test.go10
-rw-r--r--test/e2e/run_apparmor_test.go14
-rw-r--r--test/e2e/run_networking_test.go92
-rw-r--r--test/e2e/run_test.go6
-rw-r--r--test/e2e/run_volume_test.go4
23 files changed, 197 insertions, 197 deletions
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 0c665687d..b8aad1084 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -53,8 +53,8 @@ var _ = Describe("Podman build", func() {
inspect := podmanTest.Podman([]string{"inspect", iid})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectImageJSON()
- Expect(data[0].Os).To(Equal(runtime.GOOS))
- Expect(data[0].Architecture).To(Equal(runtime.GOARCH))
+ Expect(data[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(data[0]).To(HaveField("Architecture", runtime.GOARCH))
session = podmanTest.Podman([]string{"rmi", ALPINE})
session.WaitWithDefaultTimeout()
@@ -110,8 +110,8 @@ var _ = Describe("Podman build", func() {
inspect := podmanTest.Podman([]string{"inspect", "test"})
inspect.WaitWithDefaultTimeout()
data := inspect.InspectImageJSON()
- Expect(data[0].Os).To(Equal(runtime.GOOS))
- Expect(data[0].Architecture).To(Equal(runtime.GOARCH))
+ Expect(data[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(data[0]).To(HaveField("Architecture", runtime.GOARCH))
st, err := os.Stat(logfile)
Expect(err).To(BeNil())
diff --git a/test/e2e/checkpoint_image_test.go b/test/e2e/checkpoint_image_test.go
index 8274dfc80..6c2a000e8 100644
--- a/test/e2e/checkpoint_image_test.go
+++ b/test/e2e/checkpoint_image_test.go
@@ -91,9 +91,9 @@ var _ = Describe("Podman checkpoint", func() {
inspectOut := inspect.InspectContainerToJSON()
Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
- Expect(inspectOut[0].State.CheckpointPath).To(Equal(""))
- Expect(inspectOut[0].State.CheckpointLog).To(Equal(""))
- Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointPath", ""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointLog", ""))
+ Expect(inspectOut[0].State).To(HaveField("RestoreLog", ""))
result := podmanTest.Podman([]string{"container", "checkpoint", "--create-image", checkpointImage, "--keep", containerID})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 2dc99bdc9..ac1677539 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -99,9 +99,9 @@ var _ = Describe("Podman checkpoint", func() {
inspectOut := inspect.InspectContainerToJSON()
Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
- Expect(inspectOut[0].State.CheckpointPath).To(Equal(""))
- Expect(inspectOut[0].State.CheckpointLog).To(Equal(""))
- Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointPath", ""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointLog", ""))
+ Expect(inspectOut[0].State).To(HaveField("RestoreLog", ""))
result := podmanTest.Podman([]string{
"container",
@@ -125,7 +125,7 @@ var _ = Describe("Podman checkpoint", func() {
Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
Expect(inspectOut[0].State.CheckpointPath).To(ContainSubstring("userdata/checkpoint"))
Expect(inspectOut[0].State.CheckpointLog).To(ContainSubstring("userdata/dump.log"))
- Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+ Expect(inspectOut[0].State).To(HaveField("RestoreLog", ""))
result = podmanTest.Podman([]string{
"container",
@@ -179,9 +179,9 @@ var _ = Describe("Podman checkpoint", func() {
inspectOut = inspect.InspectContainerToJSON()
Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
- Expect(inspectOut[0].State.CheckpointPath).To(Equal(""))
- Expect(inspectOut[0].State.CheckpointLog).To(Equal(""))
- Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointPath", ""))
+ Expect(inspectOut[0].State).To(HaveField("CheckpointLog", ""))
+ Expect(inspectOut[0].State).To(HaveField("RestoreLog", ""))
})
It("podman checkpoint a running container by name", func() {
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index 78b607f1e..1de30e423 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -92,7 +92,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
- Expect(data[0].Comment).To(Equal("testing-commit"))
+ Expect(data[0]).To(HaveField("Comment", "testing-commit"))
})
It("podman commit container with author", func() {
@@ -107,7 +107,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
- Expect(data[0].Author).To(Equal("snoopy"))
+ Expect(data[0]).To(HaveField("Author", "snoopy"))
})
It("podman commit container with change flag", func() {
@@ -293,7 +293,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
- Expect(data[0].ID).To(Equal(string(id)))
+ Expect(data[0]).To(HaveField("ID", string(id)))
})
It("podman commit should not commit secret", func() {
diff --git a/test/e2e/container_clone_test.go b/test/e2e/container_clone_test.go
index 42b477da0..c47a89332 100644
--- a/test/e2e/container_clone_test.go
+++ b/test/e2e/container_clone_test.go
@@ -68,8 +68,8 @@ var _ = Describe("Podman container clone", func() {
ctrInspect := podmanTest.Podman([]string{"inspect", clone.OutputToString()})
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).To(Exit(0))
- Expect(ctrInspect.InspectContainerToJSON()[0].ImageName).To(Equal(fedoraMinimal))
- Expect(ctrInspect.InspectContainerToJSON()[0].Name).To(Equal("new_name"))
+ Expect(ctrInspect.InspectContainerToJSON()[0]).To(HaveField("ImageName", fedoraMinimal))
+ Expect(ctrInspect.InspectContainerToJSON()[0]).To(HaveField("Name", "new_name"))
})
It("podman container clone name test", func() {
@@ -84,7 +84,7 @@ var _ = Describe("Podman container clone", func() {
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData := cloneInspect.InspectContainerToJSON()
- Expect(cloneData[0].Name).To(Equal("testing123"))
+ Expect(cloneData[0]).To(HaveField("Name", "testing123"))
})
It("podman container clone resource limits override", func() {
@@ -104,7 +104,7 @@ var _ = Describe("Podman container clone", func() {
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData := cloneInspect.InspectContainerToJSON()
- Expect(createData[0].HostConfig.NanoCpus).To(Equal(cloneData[0].HostConfig.NanoCpus))
+ Expect(createData[0].HostConfig).To(HaveField("NanoCpus", cloneData[0].HostConfig.NanoCpus))
create = podmanTest.Podman([]string{"create", "--memory=5", ALPINE})
create.WaitWithDefaultTimeout()
@@ -122,7 +122,7 @@ var _ = Describe("Podman container clone", func() {
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData = cloneInspect.InspectContainerToJSON()
- Expect(createData[0].HostConfig.MemorySwap).To(Equal(cloneData[0].HostConfig.MemorySwap))
+ Expect(createData[0].HostConfig).To(HaveField("MemorySwap", cloneData[0].HostConfig.MemorySwap))
create = podmanTest.Podman([]string{"create", "--cpus=5", ALPINE})
create.WaitWithDefaultTimeout()
@@ -145,7 +145,7 @@ var _ = Describe("Podman container clone", func() {
Expect(cloneInspect).To(Exit(0))
cloneData = cloneInspect.InspectContainerToJSON()
Expect(createData[0].HostConfig.NanoCpus).ToNot(Equal(cloneData[0].HostConfig.NanoCpus))
- Expect(cloneData[0].HostConfig.NanoCpus).To(Equal(nanoCPUs))
+ Expect(cloneData[0].HostConfig).To(HaveField("NanoCpus", nanoCPUs))
create = podmanTest.Podman([]string{"create", ALPINE})
create.WaitWithDefaultTimeout()
@@ -158,7 +158,7 @@ var _ = Describe("Podman container clone", func() {
cloneInspect.WaitWithDefaultTimeout()
Expect(cloneInspect).To(Exit(0))
cloneData = cloneInspect.InspectContainerToJSON()
- Expect(cloneData[0].HostConfig.MemorySwappiness).To(Equal(int64(0)))
+ Expect(cloneData[0].HostConfig).To(HaveField("MemorySwappiness", int64(0)))
})
diff --git a/test/e2e/container_create_volume_test.go b/test/e2e/container_create_volume_test.go
index 62a2541b9..015b1742a 100644
--- a/test/e2e/container_create_volume_test.go
+++ b/test/e2e/container_create_volume_test.go
@@ -47,7 +47,7 @@ func checkDataVolumeContainer(pTest *PodmanTestIntegration, image, cont, dest, d
inspect := pTest.InspectContainer(cont)
Expect(inspect).To(HaveLen(1))
Expect(inspect[0].Mounts).To(HaveLen(1))
- Expect(inspect[0].Mounts[0].Destination).To(Equal(dest))
+ Expect(inspect[0].Mounts[0]).To(HaveField("Destination", dest))
mntName, mntSource := inspect[0].Mounts[0].Name, inspect[0].Mounts[0].Source
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() {
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 1e9d725b7..cddf87b74 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -66,12 +66,12 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
Expect(pod.Spec.SecurityContext).To(BeNil())
Expect(pod.Spec.DNSConfig).To(BeNil())
- Expect(pod.Spec.Containers[0].WorkingDir).To(Equal(""))
+ Expect(pod.Spec.Containers[0]).To(HaveField("WorkingDir", ""))
Expect(pod.Spec.Containers[0].Env).To(BeNil())
- Expect(pod.Name).To(Equal("top-pod"))
+ Expect(pod).To(HaveField("Name", "top-pod"))
numContainers := 0
for range pod.Spec.Containers {
@@ -165,7 +165,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
numContainers := 0
for range pod.Spec.Containers {
@@ -211,7 +211,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
numContainers := len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
Expect(numContainers).To(Equal(3))
@@ -232,7 +232,7 @@ var _ = Describe("Podman generate kube", func() {
pod = new(v1.Pod)
err = yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
numContainers = len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
Expect(numContainers).To(Equal(2))
@@ -257,7 +257,7 @@ var _ = Describe("Podman generate kube", func() {
pod = new(v1.Pod)
err = yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(false))
+ Expect(pod.Spec).To(HaveField("HostNetwork", false))
numContainers = len(pod.Spec.Containers) + len(pod.Spec.InitContainers)
Expect(numContainers).To(Equal(1))
@@ -279,7 +279,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(true))
+ Expect(pod.Spec).To(HaveField("HostNetwork", true))
})
It("podman generate kube on container with host network", func() {
@@ -294,7 +294,7 @@ var _ = Describe("Podman generate kube", func() {
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.HostNetwork).To(Equal(true))
+ Expect(pod.Spec).To(HaveField("HostNetwork", true))
})
It("podman generate kube on pod with hostAliases", func() {
@@ -325,8 +325,8 @@ var _ = Describe("Podman generate kube", func() {
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
Expect(pod.Spec.HostAliases).To(HaveLen(2))
- Expect(pod.Spec.HostAliases[0].IP).To(Equal(testIP))
- Expect(pod.Spec.HostAliases[1].IP).To(Equal(testIP))
+ Expect(pod.Spec.HostAliases[0]).To(HaveField("IP", testIP))
+ Expect(pod.Spec.HostAliases[1]).To(HaveField("IP", testIP))
})
It("podman generate service kube on pod", func() {
@@ -347,7 +347,7 @@ var _ = Describe("Podman generate kube", func() {
Expect(err).To(BeNil())
Expect(svc.Spec.Ports).To(HaveLen(1))
Expect(svc.Spec.Ports[0].TargetPort.IntValue()).To(Equal(4000))
- Expect(svc.Spec.Ports[0].Protocol).To(Equal(v1.ProtocolUDP))
+ Expect(svc.Spec.Ports[0]).To(HaveField("Protocol", v1.ProtocolUDP))
pod := new(v1.Pod)
err = yaml.Unmarshal([]byte(arr[1]), pod)
@@ -506,7 +506,7 @@ var _ = Describe("Podman generate kube", func() {
containers := pod.Spec.Containers
Expect(containers).To(HaveLen(1))
Expect(containers[0].Ports).To(HaveLen(1))
- Expect(containers[0].Ports[0].Protocol).To(Equal(v1.ProtocolUDP))
+ Expect(containers[0].Ports[0]).To(HaveField("Protocol", v1.ProtocolUDP))
})
It("podman generate and reimport kube on pod", func() {
@@ -776,8 +776,8 @@ var _ = Describe("Podman generate kube", func() {
Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0))
- Expect(pod.Spec.DNSConfig.Options[0].Name).To(Equal("color"))
- Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue"))
+ Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Name", "color"))
+ Expect(*pod.Spec.DNSConfig.Options[0]).To(HaveField("Value", "blue"))
})
It("podman generate kube multiple container dns servers and options are cumulative", func() {
@@ -819,8 +819,8 @@ var _ = Describe("Podman generate kube", func() {
Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0))
- Expect(pod.Spec.DNSConfig.Options[0].Name).To(Equal("color"))
- Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue"))
+ Expect(pod.Spec.DNSConfig.Options[0]).To(HaveField("Name", "color"))
+ Expect(*pod.Spec.DNSConfig.Options[0]).To(HaveField("Value", "blue"))
})
It("podman generate kube - set entrypoint as command", func() {
@@ -841,8 +841,8 @@ var _ = Describe("Podman generate kube", func() {
containers := pod.Spec.Containers
Expect(containers).To(HaveLen(1))
- Expect(containers[0].Command).To(Equal([]string{"/bin/sleep"}))
- Expect(containers[0].Args).To(Equal([]string{"10s"}))
+ Expect(containers[0]).To(HaveField("Command", []string{"/bin/sleep"}))
+ Expect(containers[0]).To(HaveField("Args", []string{"10s"}))
})
It("podman generate kube - use command from image unless explicitly set in the podman command", func() {
@@ -881,7 +881,7 @@ var _ = Describe("Podman generate kube", func() {
containers = pod.Spec.Containers
Expect(containers).To(HaveLen(1))
- Expect(containers[0].Command).To(Equal(cmd))
+ Expect(containers[0]).To(HaveField("Command", cmd))
})
It("podman generate kube - use entrypoint from image unless --entrypoint is set", func() {
@@ -916,7 +916,7 @@ ENTRYPOINT ["sleep"]`
containers := pod.Spec.Containers
Expect(containers).To(HaveLen(1))
- Expect(containers[0].Args).To(Equal([]string{"10s"}))
+ Expect(containers[0]).To(HaveField("Args", []string{"10s"}))
session = podmanTest.Podman([]string{"create", "--pod", "new:testpod-2", "--entrypoint", "echo", image, "hello"})
session.WaitWithDefaultTimeout()
@@ -934,8 +934,8 @@ ENTRYPOINT ["sleep"]`
containers = pod.Spec.Containers
Expect(containers).To(HaveLen(1))
- Expect(containers[0].Command).To(Equal([]string{"echo"}))
- Expect(containers[0].Args).To(Equal([]string{"hello"}))
+ Expect(containers[0]).To(HaveField("Command", []string{"echo"}))
+ Expect(containers[0]).To(HaveField("Args", []string{"hello"}))
})
It("podman generate kube - --privileged container", func() {
@@ -1018,7 +1018,7 @@ USER test1`
pvc := new(v1.PersistentVolumeClaim)
err := yaml.Unmarshal(kube.Out.Contents(), pvc)
Expect(err).To(BeNil())
- Expect(pvc.Name).To(Equal(vol))
+ Expect(pvc).To(HaveField("Name", vol))
Expect(pvc.Spec.AccessModes[0]).To(Equal(v1.ReadWriteOnce))
Expect(pvc.Spec.Resources.Requests.Storage().String()).To(Equal("1Gi"))
})
@@ -1040,7 +1040,7 @@ USER test1`
pvc := new(v1.PersistentVolumeClaim)
err := yaml.Unmarshal(kube.Out.Contents(), pvc)
Expect(err).To(BeNil())
- Expect(pvc.Name).To(Equal(vol))
+ Expect(pvc).To(HaveField("Name", vol))
Expect(pvc.Spec.AccessModes[0]).To(Equal(v1.ReadWriteOnce))
Expect(pvc.Spec.Resources.Requests.Storage().String()).To(Equal("1Gi"))
@@ -1092,8 +1092,8 @@ USER test1`
pod := new(v1.Pod)
err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil())
- Expect(pod.Spec.Containers[0].WorkingDir).To(Equal(""))
- Expect(pod.Spec.Containers[1].WorkingDir).To(Equal("/root"))
+ Expect(pod.Spec.Containers[0]).To(HaveField("WorkingDir", ""))
+ Expect(pod.Spec.Containers[1]).To(HaveField("WorkingDir", "/root"))
for _, ctr := range []string{"top1", "top2"} {
Expect(pod.Annotations).To(HaveKeyWithValue("io.containers.autoupdate/"+ctr, "registry"))
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index 23f1a1dbf..a41c10162 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -168,7 +168,7 @@ var _ = Describe("Podman healthcheck run", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health).To(HaveField("Status", "starting"))
})
It("podman healthcheck failed checks in start-period should not change status", func() {
@@ -189,9 +189,9 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health).To(HaveField("Status", "starting"))
// test old podman compat (see #11645)
- Expect(inspect[0].State.Healthcheck().Status).To(Equal("starting"))
+ Expect(inspect[0].State.Healthcheck()).To(HaveField("Status", "starting"))
})
It("podman healthcheck failed checks must reach retries before unhealthy ", func() {
@@ -204,16 +204,16 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health).To(HaveField("Status", "starting"))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
Expect(hc).Should(Exit(1))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckUnhealthy))
+ Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckUnhealthy))
// test old podman compat (see #11645)
- Expect(inspect[0].State.Healthcheck().Status).To(Equal(define.HealthCheckUnhealthy))
+ Expect(inspect[0].State.Healthcheck()).To(HaveField("Status", define.HealthCheckUnhealthy))
})
It("podman healthcheck good check results in healthy even in start-period", func() {
@@ -226,7 +226,7 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(0))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckHealthy))
+ Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckHealthy))
})
It("podman healthcheck unhealthy but valid arguments check", func() {
@@ -249,14 +249,14 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health).To(HaveField("Status", "starting"))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
Expect(hc).Should(Exit(1))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckUnhealthy))
+ Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckUnhealthy))
foo := podmanTest.Podman([]string{"exec", "hc", "touch", "/foo"})
foo.WaitWithDefaultTimeout()
@@ -267,7 +267,7 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(0))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckHealthy))
+ Expect(inspect[0].State.Health).To(HaveField("Status", define.HealthCheckHealthy))
// Test podman ps --filter heath is working (#11687)
ps := podmanTest.Podman([]string{"ps", "--filter", "health=healthy"})
@@ -328,6 +328,6 @@ HEALTHCHECK CMD ls -l / 2>&1`, ALPINE)
// Check to make sure a default time interval value was added
Expect(inspect[0].Config.Healthcheck.Interval).To(BeNumerically("==", 30000000000))
// Check to make sure characters were not coerced to utf8
- Expect(inspect[0].Config.Healthcheck.Test).To(Equal([]string{"CMD-SHELL", "ls -l / 2>&1"}))
+ Expect(inspect[0].Config.Healthcheck).To(HaveField("Test", []string{"CMD-SHELL", "ls -l / 2>&1"}))
})
})
diff --git a/test/e2e/image_scp_test.go b/test/e2e/image_scp_test.go
index 5abdf74f8..2ad3cc75e 100644
--- a/test/e2e/image_scp_test.go
+++ b/test/e2e/image_scp_test.go
@@ -75,7 +75,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).To(HaveField("ActiveService", "QA"))
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/init_test.go b/test/e2e/init_test.go
index c4c090daf..fdb2b41a1 100644
--- a/test/e2e/init_test.go
+++ b/test/e2e/init_test.go
@@ -57,7 +57,7 @@ var _ = Describe("Podman init", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].State.Status).To(Equal("initialized"))
+ Expect(conData[0].State).To(HaveField("Status", "initialized"))
})
It("podman init single container by name", func() {
@@ -72,7 +72,7 @@ var _ = Describe("Podman init", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].State.Status).To(Equal("initialized"))
+ Expect(conData[0].State).To(HaveField("Status", "initialized"))
})
It("podman init latest container", func() {
@@ -87,7 +87,7 @@ var _ = Describe("Podman init", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].State.Status).To(Equal("initialized"))
+ Expect(conData[0].State).To(HaveField("Status", "initialized"))
})
It("podman init all three containers, one running", func() {
@@ -107,17 +107,17 @@ var _ = Describe("Podman init", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].State.Status).To(Equal("initialized"))
+ Expect(conData[0].State).To(HaveField("Status", "initialized"))
result2 := podmanTest.Podman([]string{"inspect", "test2"})
result2.WaitWithDefaultTimeout()
Expect(result2).Should(Exit(0))
conData2 := result2.InspectContainerToJSON()
- Expect(conData2[0].State.Status).To(Equal("initialized"))
+ Expect(conData2[0].State).To(HaveField("Status", "initialized"))
result3 := podmanTest.Podman([]string{"inspect", "test3"})
result3.WaitWithDefaultTimeout()
Expect(result3).Should(Exit(0))
conData3 := result3.InspectContainerToJSON()
- Expect(conData3[0].State.Status).To(Equal("running"))
+ Expect(conData3[0].State).To(HaveField("Status", "running"))
})
It("podman init running container errors", func() {
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index bb5a3a6ad..25b938d07 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -189,7 +189,7 @@ var _ = Describe("Podman inspect", func() {
imageData := session.InspectImageJSON()
Expect(imageData[0].HealthCheck.Timeout).To(BeNumerically("==", 3000000000))
Expect(imageData[0].HealthCheck.Interval).To(BeNumerically("==", 60000000000))
- Expect(imageData[0].HealthCheck.Test).To(Equal([]string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"}))
+ Expect(imageData[0].HealthCheck).To(HaveField("Test", []string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"}))
})
It("podman inspect --latest with no container fails", func() {
@@ -217,7 +217,7 @@ var _ = Describe("Podman inspect", func() {
imageJSON := imageInspect.InspectImageJSON()
Expect(imageJSON).To(HaveLen(1))
- Expect(baseJSON[0].ID).To(Equal(imageJSON[0].ID))
+ Expect(baseJSON[0]).To(HaveField("ID", imageJSON[0].ID))
})
It("podman [image, container] inspect on container", func() {
@@ -242,7 +242,7 @@ var _ = Describe("Podman inspect", func() {
imageInspect.WaitWithDefaultTimeout()
Expect(imageInspect).To(ExitWithError())
- Expect(baseJSON[0].ID).To(Equal(ctrJSON[0].ID))
+ Expect(baseJSON[0]).To(HaveField("ID", ctrJSON[0].ID))
})
It("podman inspect always produces a valid array", func() {
@@ -264,7 +264,7 @@ var _ = Describe("Podman inspect", func() {
Expect(baseInspect).To(ExitWithError())
baseJSON := baseInspect.InspectContainerToJSON()
Expect(baseJSON).To(HaveLen(1))
- Expect(baseJSON[0].Name).To(Equal(ctrName))
+ Expect(baseJSON[0]).To(HaveField("Name", ctrName))
})
It("podman inspect container + image with same name gives container", func() {
@@ -283,7 +283,7 @@ var _ = Describe("Podman inspect", func() {
Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
Expect(baseJSON).To(HaveLen(1))
- Expect(baseJSON[0].Name).To(Equal(ctrName))
+ Expect(baseJSON[0]).To(HaveField("Name", ctrName))
})
It("podman inspect - HostConfig.SecurityOpt ", func() {
@@ -307,7 +307,7 @@ var _ = Describe("Podman inspect", func() {
Expect(baseInspect).Should(Exit(0))
baseJSON := baseInspect.InspectContainerToJSON()
Expect(baseJSON).To(HaveLen(1))
- Expect(baseJSON[0].HostConfig.SecurityOpt).To(Equal([]string{"label=type:spc_t,label=level:s0", "seccomp=unconfined"}))
+ Expect(baseJSON[0].HostConfig).To(HaveField("SecurityOpt", []string{"label=type:spc_t,label=level:s0", "seccomp=unconfined"}))
})
It("podman inspect pod", func() {
@@ -321,7 +321,7 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
- Expect(podData[0].Name).To(Equal(podName))
+ Expect(podData[0]).To(HaveField("Name", podName))
})
It("podman inspect pod with type", func() {
@@ -335,7 +335,7 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
- Expect(podData[0].Name).To(Equal(podName))
+ Expect(podData[0]).To(HaveField("Name", podName))
})
It("podman inspect latest pod", func() {
@@ -350,7 +350,7 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
- Expect(podData[0].Name).To(Equal(podName))
+ Expect(podData[0]).To(HaveField("Name", podName))
})
It("podman inspect latest defaults to latest container", func() {
SkipIfRemote("--latest flag n/a")
@@ -371,7 +371,7 @@ var _ = Describe("Podman inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
containerData := inspect.InspectContainerToJSON()
- Expect(containerData[0].Name).To(Equal(infra))
+ Expect(containerData[0]).To(HaveField("Name", infra))
})
It("podman inspect network", func() {
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index 82b99bd68..a6e927ca2 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -59,7 +59,7 @@ var _ = Describe("Podman network create", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.Name).To(Equal(netName))
+ Expect(result).To(HaveField("Name", netName))
Expect(result.Subnets).To(HaveLen(1))
Expect(result.Subnets[0].Subnet.String()).To(Equal("10.11.12.0/24"))
Expect(result.Subnets[0].Gateway.String()).To(Equal("10.11.12.1"))
@@ -102,7 +102,7 @@ var _ = Describe("Podman network create", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.Name).To(Equal(netName))
+ Expect(result).To(HaveField("Name", netName))
Expect(result.Subnets).To(HaveLen(1))
Expect(result.Subnets[0].Gateway.String()).To(Equal("fd00:1:2:3::1"))
Expect(result.Subnets[0].Subnet.String()).To(Equal("fd00:1:2:3::/64"))
@@ -141,7 +141,7 @@ var _ = Describe("Podman network create", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.Name).To(Equal(netName))
+ Expect(result).To(HaveField("Name", netName))
Expect(result.Subnets).To(HaveLen(2))
Expect(result.Subnets[0].Subnet.IP).ToNot(BeNil())
Expect(result.Subnets[1].Subnet.IP).ToNot(BeNil())
@@ -173,7 +173,7 @@ var _ = Describe("Podman network create", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result = results[0]
- Expect(result.Name).To(Equal(netName2))
+ Expect(result).To(HaveField("Name", netName2))
Expect(result.Subnets).To(HaveLen(2))
Expect(result.Subnets[0].Subnet.IP).ToNot(BeNil())
Expect(result.Subnets[1].Subnet.IP).ToNot(BeNil())
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index 89a9005f5..c67a4baed 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -293,8 +293,8 @@ var _ = Describe("Podman network", func() {
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(1))
net, ok := conData[0].NetworkSettings.Networks[netName]
Expect(ok).To(BeTrue())
- Expect(net.NetworkID).To(Equal(netName))
- Expect(net.IPPrefixLen).To(Equal(24))
+ Expect(net).To(HaveField("NetworkID", netName))
+ Expect(net).To(HaveField("IPPrefixLen", 24))
Expect(net.IPAddress).To(HavePrefix("10.50.50."))
// Necessary to ensure the CNI network is removed cleanly
@@ -329,10 +329,10 @@ var _ = Describe("Podman network", func() {
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
net1, ok := conData[0].NetworkSettings.Networks[netName1]
Expect(ok).To(BeTrue())
- Expect(net1.NetworkID).To(Equal(netName1))
+ Expect(net1).To(HaveField("NetworkID", netName1))
net2, ok := conData[0].NetworkSettings.Networks[netName2]
Expect(ok).To(BeTrue())
- Expect(net2.NetworkID).To(Equal(netName2))
+ Expect(net2).To(HaveField("NetworkID", netName2))
// Necessary to ensure the CNI network is removed cleanly
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
@@ -366,13 +366,13 @@ var _ = Describe("Podman network", func() {
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
net1, ok := conData[0].NetworkSettings.Networks[netName1]
Expect(ok).To(BeTrue())
- Expect(net1.NetworkID).To(Equal(netName1))
- Expect(net1.IPPrefixLen).To(Equal(25))
+ Expect(net1).To(HaveField("NetworkID", netName1))
+ Expect(net1).To(HaveField("IPPrefixLen", 25))
Expect(net1.IPAddress).To(HavePrefix("10.50.51."))
net2, ok := conData[0].NetworkSettings.Networks[netName2]
Expect(ok).To(BeTrue())
- Expect(net2.NetworkID).To(Equal(netName2))
- Expect(net2.IPPrefixLen).To(Equal(26))
+ Expect(net2).To(HaveField("NetworkID", netName2))
+ Expect(net2).To(HaveField("IPPrefixLen", 26))
Expect(net2.IPAddress).To(HavePrefix("10.50.51."))
// Necessary to ensure the CNI network is removed cleanly
@@ -601,7 +601,7 @@ var _ = Describe("Podman network", func() {
Expect(err).To(BeNil())
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.NetworkInterface).To(Equal(""))
+ Expect(result).To(HaveField("NetworkInterface", ""))
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
nc = podmanTest.Podman([]string{"network", "rm", net})
@@ -628,8 +628,8 @@ var _ = Describe("Podman network", func() {
Expect(results).To(HaveLen(1))
result := results[0]
- Expect(result.Driver).To(Equal("macvlan"))
- Expect(result.NetworkInterface).To(Equal("lo"))
+ Expect(result).To(HaveField("Driver", "macvlan"))
+ Expect(result).To(HaveField("NetworkInterface", "lo"))
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
Expect(result.Subnets).To(HaveLen(0))
@@ -672,8 +672,8 @@ var _ = Describe("Podman network", func() {
result := results[0]
Expect(result.Options).To(HaveKeyWithValue("mtu", "1500"))
- Expect(result.Driver).To(Equal("macvlan"))
- Expect(result.NetworkInterface).To(Equal("lo"))
+ Expect(result).To(HaveField("Driver", "macvlan"))
+ Expect(result).To(HaveField("NetworkInterface", "lo"))
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "host-local"))
Expect(result.Subnets).To(HaveLen(1))
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 46a8e88bc..aaefa4625 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -2220,7 +2220,7 @@ spec:
Expect(ctr[0].Config.WorkingDir).To(ContainSubstring("/etc"))
Expect(ctr[0].Config.Labels).To(HaveKeyWithValue("key1", ContainSubstring("value1")))
Expect(ctr[0].Config.Labels).To(HaveKeyWithValue("key1", ContainSubstring("value1")))
- Expect(ctr[0].Config.StopSignal).To(Equal(uint(51)))
+ Expect(ctr[0].Config).To(HaveField("StopSignal", uint(51)))
})
// Deployment related tests
@@ -2528,7 +2528,7 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
// only one will be mounted. Host path volumes take precedence.
ctrJSON := inspect.InspectContainerToJSON()
Expect(ctrJSON[0].Mounts).To(HaveLen(1))
- Expect(ctrJSON[0].Mounts[0].Type).To(Equal("bind"))
+ Expect(ctrJSON[0].Mounts[0]).To(HaveField("Type", "bind"))
})
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 8def80213..0c7886a93 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -279,7 +279,7 @@ var _ = Describe("Podman pod create", func() {
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).Should(Exit(0))
ctrJSON := ctrInspect.InspectContainerToJSON()
- Expect(ctrJSON[0].NetworkSettings.IPAddress).To(Equal(ip))
+ Expect(ctrJSON[0].NetworkSettings).To(HaveField("IPAddress", ip))
})
It("podman create pod with IP address and no infra should fail", func() {
@@ -336,7 +336,7 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"pod", "inspect", "abc"})
check.WaitWithDefaultTimeout()
data := check.InspectPodToJSON()
- Expect(data.ID).To(Equal(string(id)))
+ Expect(data).To(HaveField("ID", string(id)))
})
It("podman pod create --replace", func() {
@@ -551,8 +551,8 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON := podInspect.InspectPodToJSON()
- Expect(podJSON.CPUPeriod).To(Equal(period))
- Expect(podJSON.CPUQuota).To(Equal(quota))
+ Expect(podJSON).To(HaveField("CPUPeriod", period))
+ Expect(podJSON).To(HaveField("CPUQuota", quota))
})
It("podman pod create --cpuset-cpus", func() {
@@ -573,7 +573,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON := podInspect.InspectPodToJSON()
- Expect(podJSON.CPUSetCPUs).To(Equal(in))
+ Expect(podJSON).To(HaveField("CPUSetCPUs", in))
})
It("podman pod create --pid", func() {
@@ -587,7 +587,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON := podInspect.InspectPodToJSON()
- Expect(podJSON.InfraConfig.PidNS).To(Equal(ns))
+ Expect(podJSON.InfraConfig).To(HaveField("PidNS", ns))
podName = "pidPod2"
ns = "pod"
@@ -607,7 +607,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON = podInspect.InspectPodToJSON()
- Expect(podJSON.InfraConfig.PidNS).To(Equal("host"))
+ Expect(podJSON.InfraConfig).To(HaveField("PidNS", "host"))
podName = "pidPod4"
ns = "private"
@@ -620,7 +620,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podJSON = podInspect.InspectPodToJSON()
- Expect(podJSON.InfraConfig.PidNS).To(Equal("private"))
+ Expect(podJSON.InfraConfig).To(HaveField("PidNS", "private"))
podName = "pidPod5"
ns = "container:randomfakeid"
@@ -856,7 +856,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
data := podInspect.InspectPodToJSON()
- Expect(data.Mounts[0].Name).To(Equal(volName))
+ Expect(data.Mounts[0]).To(HaveField("Name", volName))
ctrName := "testCtr"
ctrCreate := podmanTest.Podman([]string{"create", "--pod", podName, "--name", ctrName, ALPINE})
ctrCreate.WaitWithDefaultTimeout()
@@ -865,7 +865,7 @@ ENTRYPOINT ["sleep","99999"]
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).Should(Exit(0))
ctrData := ctrInspect.InspectContainerToJSON()
- Expect(ctrData[0].Mounts[0].Name).To(Equal(volName))
+ Expect(ctrData[0].Mounts[0]).To(HaveField("Name", volName))
ctr2 := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "sh", "-c", "echo hello >> " + "/tmp1/test"})
ctr2.WaitWithDefaultTimeout()
@@ -934,7 +934,7 @@ ENTRYPOINT ["sleep","99999"]
ctrInspect.WaitWithDefaultTimeout()
Expect(ctrInspect).Should(Exit(0))
data := ctrInspect.InspectContainerToJSON()
- Expect(data[0].Mounts[0].Name).To(Equal(volName))
+ Expect(data[0].Mounts[0]).To(HaveField("Name", volName))
podName := "testPod"
podCreate := podmanTest.Podman([]string{"pod", "create", "--volumes-from", ctrName, "--name", podName})
podCreate.WaitWithDefaultTimeout()
@@ -943,7 +943,7 @@ ENTRYPOINT ["sleep","99999"]
podInspect.WaitWithDefaultTimeout()
Expect(podInspect).Should(Exit(0))
podData := podInspect.InspectPodToJSON()
- Expect(podData.Mounts[0].Name).To(Equal(volName))
+ Expect(podData.Mounts[0]).To(HaveField("Name", volName))
ctr2 := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "sh", "-c", "echo hello >> " + "/tmp1/test"})
ctr2.WaitWithDefaultTimeout()
@@ -986,7 +986,7 @@ ENTRYPOINT ["sleep","99999"]
Expect(ctrCreate).Should(Exit(0))
ctrInspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
- Expect(ctrInspect[0].HostConfig.SecurityOpt).To(Equal([]string{"label=type:spc_t", "seccomp=unconfined"}))
+ Expect(ctrInspect[0].HostConfig).To(HaveField("SecurityOpt", []string{"label=type:spc_t", "seccomp=unconfined"}))
podCreate = podmanTest.Podman([]string{"pod", "create", "--security-opt", "label=disable"})
podCreate.WaitWithDefaultTimeout()
@@ -1012,7 +1012,7 @@ ENTRYPOINT ["sleep","99999"]
Expect(ctrCreate).Should(Exit(0))
ctrInspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
- Expect(ctrInspect[0].HostConfig.SecurityOpt).To(Equal([]string{"seccomp=unconfined"}))
+ Expect(ctrInspect[0].HostConfig).To(HaveField("SecurityOpt", []string{"seccomp=unconfined"}))
})
It("podman pod create --security-opt apparmor test", func() {
@@ -1028,7 +1028,7 @@ ENTRYPOINT ["sleep","99999"]
Expect(ctrCreate).Should(Exit(0))
inspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
- Expect(inspect[0].AppArmorProfile).To(Equal(apparmor.Profile))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", apparmor.Profile))
})
@@ -1090,7 +1090,7 @@ ENTRYPOINT ["sleep","99999"]
if podmanTest.CgroupManager == "cgroupfs" || !rootless.IsRootless() {
Expect(inspect[0].HostConfig.CgroupParent).To(HaveLen(0))
} else if podmanTest.CgroupManager == "systemd" {
- Expect(inspect[0].HostConfig.CgroupParent).To(Equal("user.slice"))
+ Expect(inspect[0].HostConfig).To(HaveField("CgroupParent", "user.slice"))
}
podCreate2 := podmanTest.Podman([]string{"pod", "create", "--share", "cgroup,ipc,net,uts", "--share-parent=false", "--infra-name", "cgroupCtr"})
diff --git a/test/e2e/pod_initcontainers_test.go b/test/e2e/pod_initcontainers_test.go
index cefaa3dc1..3c660c5bf 100644
--- a/test/e2e/pod_initcontainers_test.go
+++ b/test/e2e/pod_initcontainers_test.go
@@ -66,7 +66,7 @@ var _ = Describe("Podman init containers", func() {
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
data := inspect.InspectPodToJSON()
- Expect(data.State).To(Equal(define.PodStateRunning))
+ Expect(data).To(HaveField("State", define.PodStateRunning))
})
It("podman create init container should fail in running pod", func() {
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index 19a2772fd..dcc70e4a5 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -58,7 +58,7 @@ var _ = Describe("Podman pod inspect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodToJSON()
- Expect(podData.ID).To(Equal(podid))
+ Expect(podData).To(HaveField("ID", podid))
})
It("podman pod inspect (CreateCommand)", func() {
@@ -98,7 +98,7 @@ var _ = Describe("Podman pod inspect", func() {
Expect(err).To(BeNil())
Expect(inspectJSON.InfraConfig).To(Not(BeNil()))
Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"]).To(HaveLen(1))
- Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0].HostPort).To(Equal("8383"))
+ Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0]).To(HaveField("HostPort", "8383"))
})
It("podman pod inspect outputs show correct MAC", func() {
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index 231869e8c..d13334651 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -514,7 +514,7 @@ var _ = Describe("Podman pull", func() {
Expect(data).To(HaveLen(1))
Expect(data[0].RepoTags).To(HaveLen(1))
Expect(data[0].RepoTags[0]).To(Equal(t.tag1))
- Expect(data[0].ID).To(Equal(image1))
+ Expect(data[0]).To(HaveField("ID", image1))
}
})
@@ -541,8 +541,8 @@ var _ = Describe("Podman pull", func() {
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(data).To(HaveLen(1))
- Expect(data[0].Os).To(Equal(runtime.GOOS))
- Expect(data[0].Architecture).To(Equal("arm64"))
+ Expect(data[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(data[0]).To(HaveField("Architecture", "arm64"))
})
It("podman pull --arch", func() {
@@ -568,7 +568,7 @@ var _ = Describe("Podman pull", func() {
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(data).To(HaveLen(1))
- Expect(data[0].Os).To(Equal(runtime.GOOS))
- Expect(data[0].Architecture).To(Equal("arm64"))
+ Expect(data[0]).To(HaveField("Os", runtime.GOOS))
+ Expect(data[0]).To(HaveField("Architecture", "arm64"))
})
})
diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go
index 64a01deb7..ed88ab7a0 100644
--- a/test/e2e/run_apparmor_test.go
+++ b/test/e2e/run_apparmor_test.go
@@ -61,7 +61,7 @@ var _ = Describe("Podman run", func() {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(apparmor.Profile))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", apparmor.Profile))
})
It("podman run no apparmor --privileged", func() {
@@ -73,7 +73,7 @@ var _ = Describe("Podman run", func() {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(""))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", ""))
})
It("podman run no apparmor --security-opt=apparmor.Profile --privileged", func() {
@@ -85,7 +85,7 @@ var _ = Describe("Podman run", func() {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(apparmor.Profile))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", apparmor.Profile))
})
It("podman run apparmor aa-test-profile", func() {
@@ -116,7 +116,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal("aa-test-profile"))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", "aa-test-profile"))
})
It("podman run apparmor invalid", func() {
@@ -135,7 +135,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal("unconfined"))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", "unconfined"))
})
It("podman run apparmor disabled --security-opt apparmor fails", func() {
@@ -156,7 +156,7 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(""))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", ""))
})
It("podman run apparmor disabled unconfined", func() {
@@ -169,6 +169,6 @@ profile aa-test-profile flags=(attach_disconnected,mediate_deleted) {
cid := session.OutputToString()
// Verify that apparmor.Profile is being set
inspect := podmanTest.InspectContainer(cid)
- Expect(inspect[0].AppArmorProfile).To(Equal(""))
+ Expect(inspect[0]).To(HaveField("AppArmorProfile", ""))
})
})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index baec444e4..53a91b2b3 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -99,7 +99,7 @@ var _ = Describe("Podman run networking", func() {
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 80-82 -p 8090:8090", func() {
@@ -111,16 +111,16 @@ var _ = Describe("Podman run networking", func() {
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(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
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(inspectOut[0].NetworkSettings.Ports["81/tcp"][0]).To(HaveField("HostIP", ""))
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(inspectOut[0].NetworkSettings.Ports["82/tcp"][0]).To(HaveField("HostIP", ""))
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0]).To(HaveField("HostPort", "8090"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 80-81 -p 8180-8181", func() {
@@ -132,16 +132,16 @@ var _ = Describe("Podman run networking", func() {
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(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
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(inspectOut[0].NetworkSettings.Ports["81/tcp"][0]).To(HaveField("HostIP", ""))
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(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0]).To(HaveField("HostIP", ""))
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 80 -p 8280-8282:8280-8282", func() {
@@ -153,16 +153,16 @@ var _ = Describe("Podman run networking", func() {
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(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
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(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0]).To(HaveField("HostPort", "8280"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0]).To(HaveField("HostIP", ""))
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(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0]).To(HaveField("HostPort", "8281"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0]).To(HaveField("HostIP", ""))
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0]).To(HaveField("HostPort", "8282"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 8380:80", func() {
@@ -173,8 +173,8 @@ var _ = Describe("Podman run networking", func() {
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "8380"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 8480:80/TCP", func() {
@@ -187,8 +187,8 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports).To(HaveLen(1))
// "tcp" in lower characters
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "8480"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 80/udp", func() {
@@ -200,7 +200,7 @@ var _ = Describe("Podman run networking", func() {
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p 127.0.0.1:8580:80", func() {
@@ -211,8 +211,8 @@ var _ = Describe("Podman run networking", func() {
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"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "8580"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", "127.0.0.1"))
})
It("podman run -p 127.0.0.1:8680:80/udp", func() {
@@ -223,8 +223,8 @@ var _ = Describe("Podman run networking", func() {
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"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostPort", "8680"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", "127.0.0.1"))
})
It("podman run -p [::1]:8780:80/udp", func() {
@@ -235,8 +235,8 @@ var _ = Describe("Podman run networking", func() {
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"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostPort", "8780"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", "::1"))
})
It("podman run -p [::1]:8880:80/tcp", func() {
@@ -247,8 +247,8 @@ var _ = Describe("Podman run networking", func() {
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"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "8880"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", "::1"))
})
It("podman run --expose 80 -P", func() {
@@ -260,7 +260,7 @@ var _ = Describe("Podman run networking", func() {
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run --expose 80/udp -P", func() {
@@ -272,7 +272,7 @@ var _ = Describe("Podman run networking", func() {
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0]).To(HaveField("HostIP", ""))
})
It("podman run --expose 80 -p 80", func() {
@@ -284,7 +284,7 @@ var _ = Describe("Podman run networking", func() {
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run --publish-all with EXPOSE port ranges in Dockerfile", func() {
@@ -332,7 +332,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
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"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0]).To(HaveField("HostIP", "127.0.0.1"))
})
It("podman run -p :8181", func() {
@@ -344,7 +344,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run -p xxx:8080 -p yyy:8080", func() {
@@ -371,8 +371,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)
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(""))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostPort", "9280"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0]).To(HaveField("HostIP", ""))
})
It("podman run network expose host port 80 to container port", func() {
@@ -763,18 +763,18 @@ EXPOSE 2004-2005/tcp`, ALPINE)
checkNetworkNsInspect := func(name string) {
inspectOut := podmanTest.InspectContainer(name)
- Expect(inspectOut[0].NetworkSettings.IPAddress).To(Equal("10.25.40.0"))
- Expect(inspectOut[0].NetworkSettings.IPPrefixLen).To(Equal(24))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("IPAddress", "10.25.40.0"))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("IPPrefixLen", 24))
Expect(len(inspectOut[0].NetworkSettings.SecondaryIPAddresses)).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0].Addr).To(Equal("10.88.0.0"))
- Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0].PrefixLength).To(Equal(16))
- Expect(inspectOut[0].NetworkSettings.GlobalIPv6Address).To(Equal("fd04:3e42:4a4e:3381::"))
- Expect(inspectOut[0].NetworkSettings.GlobalIPv6PrefixLen).To(Equal(64))
+ Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0]).To(HaveField("Addr", "10.88.0.0"))
+ Expect(inspectOut[0].NetworkSettings.SecondaryIPAddresses[0]).To(HaveField("PrefixLength", 16))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("GlobalIPv6Address", "fd04:3e42:4a4e:3381::"))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("GlobalIPv6PrefixLen", 64))
Expect(len(inspectOut[0].NetworkSettings.SecondaryIPv6Addresses)).To(Equal(0))
- Expect(inspectOut[0].NetworkSettings.MacAddress).To(Equal("46:7f:45:6e:4f:c8"))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("MacAddress", "46:7f:45:6e:4f:c8"))
Expect(len(inspectOut[0].NetworkSettings.AdditionalMacAddresses)).To(Equal(1))
Expect(inspectOut[0].NetworkSettings.AdditionalMacAddresses[0]).To(Equal("56:6e:35:5d:3e:a8"))
- Expect(inspectOut[0].NetworkSettings.Gateway).To(Equal("10.25.40.0"))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("Gateway", "10.25.40.0"))
}
@@ -796,7 +796,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(delNetworkNamespace).Should(Exit(0))
inspectOut := podmanTest.InspectContainer(name)
- Expect(inspectOut[0].NetworkSettings.IPAddress).To(Equal(""))
+ Expect(inspectOut[0].NetworkSettings).To(HaveField("IPAddress", ""))
Expect(len(inspectOut[0].NetworkSettings.Networks)).To(Equal(0))
})
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 4c399dc2b..386a27a2f 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -288,7 +288,7 @@ var _ = Describe("Podman run", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].Path).To(Equal("/dev/init"))
+ Expect(conData[0]).To(HaveField("Path", "/dev/init"))
Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "TRUE"))
})
@@ -300,7 +300,7 @@ var _ = Describe("Podman run", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].Path).To(Equal("/dev/init"))
+ Expect(conData[0]).To(HaveField("Path", "/dev/init"))
Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "TRUE"))
})
@@ -312,7 +312,7 @@ var _ = Describe("Podman run", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
conData := result.InspectContainerToJSON()
- Expect(conData[0].Path).To(Equal("ls"))
+ Expect(conData[0]).To(HaveField("Path", "ls"))
Expect(conData[0].Config.Annotations).To(HaveKeyWithValue("io.podman.annotations.init", "FALSE"))
})
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index a31c1959e..4f1013f8d 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -588,8 +588,8 @@ VOLUME /test/`, ALPINE)
data := podmanTest.InspectContainer(ctrName)
Expect(data).To(HaveLen(1))
Expect(data[0].Mounts).To(HaveLen(1))
- Expect(data[0].Mounts[0].Source).To(Equal("/tmp"))
- Expect(data[0].Mounts[0].Destination).To(Equal("/test"))
+ Expect(data[0].Mounts[0]).To(HaveField("Source", "/tmp"))
+ Expect(data[0].Mounts[0]).To(HaveField("Destination", "/test"))
})
It("podman run with overlay volume flag", func() {