mirror of
https://github.com/containers/podman.git
synced 2025-06-29 23:22:40 +08:00
Merge pull request #12454 from edsantiago/remove_betrue
More BeTrue cleanup
This commit is contained in:
@ -427,13 +427,10 @@ subdir**`
|
|||||||
session := podmanTest.Podman([]string{"build", "-t", "test", "."})
|
session := podmanTest.Podman([]string{"build", "-t", "test", "."})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
ok, _ := session.GrepString("/testfilter/dummy1")
|
output := session.OutputToString()
|
||||||
Expect(ok).NotTo(BeTrue())
|
Expect(output).To(ContainSubstring("/testfilter/dummy2"))
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/testfilter/dummy2"))
|
Expect(output).NotTo(ContainSubstring("/testfilter/dummy1"))
|
||||||
ok, _ = session.GrepString("/testfilter/subdir")
|
Expect(output).NotTo(ContainSubstring("/testfilter/subdir"))
|
||||||
Expect(ok).NotTo(BeTrue()) //.dockerignore filters both subdir and inside subdir
|
|
||||||
ok, _ = session.GrepString("/testfilter/subdir/dummy3")
|
|
||||||
Expect(ok).NotTo(BeTrue())
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman remote test context dir contains empty dirs and symlinks", func() {
|
It("podman remote test context dir contains empty dirs and symlinks", func() {
|
||||||
|
@ -102,7 +102,7 @@ var _ = Describe("Podman checkpoint", func() {
|
|||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
inspectOut := inspect.InspectContainerToJSON()
|
inspectOut := inspect.InspectContainerToJSON()
|
||||||
Expect(inspectOut[0].State.Checkpointed).To(BeTrue())
|
Expect(inspectOut[0].State.Checkpointed).To(BeTrue(), ".State.Checkpointed")
|
||||||
|
|
||||||
result = podmanTest.Podman([]string{"container", "restore", cid})
|
result = podmanTest.Podman([]string{"container", "restore", cid})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
|
@ -225,7 +225,7 @@ var _ = Describe("Podman commit", func() {
|
|||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
image := inspect.InspectImageJSON()
|
image := inspect.InspectImageJSON()
|
||||||
_, ok := image[0].Config.Volumes["/foo"]
|
_, ok := image[0].Config.Volumes["/foo"]
|
||||||
Expect(ok).To(BeTrue())
|
Expect(ok).To(BeTrue(), ".Config.Volumes[/foo]")
|
||||||
|
|
||||||
r := podmanTest.Podman([]string{"run", "newimage"})
|
r := podmanTest.Podman([]string{"run", "newimage"})
|
||||||
r.WaitWithDefaultTimeout()
|
r.WaitWithDefaultTimeout()
|
||||||
@ -250,7 +250,7 @@ var _ = Describe("Podman commit", func() {
|
|||||||
for _, v := range image[0].Config.Env {
|
for _, v := range image[0].Config.Env {
|
||||||
envMap[v] = true
|
envMap[v] = true
|
||||||
}
|
}
|
||||||
Expect(envMap["TEST=1=1-01=9.01"]).To(BeTrue())
|
Expect(envMap["TEST=1=1-01=9.01"]).To(BeTrue(), "envMap[TEST=1=1-01=9.01]")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman commit container and print id to external file", func() {
|
It("podman commit container and print id to external file", func() {
|
||||||
|
@ -108,7 +108,7 @@ var _ = Describe("Podman create", func() {
|
|||||||
check.WaitWithDefaultTimeout()
|
check.WaitWithDefaultTimeout()
|
||||||
data := check.InspectContainerToJSON()
|
data := check.InspectContainerToJSON()
|
||||||
value, ok := data[0].Config.Annotations["HELLO"]
|
value, ok := data[0].Config.Annotations["HELLO"]
|
||||||
Expect(ok).To(BeTrue())
|
Expect(ok).To(BeTrue(), ".Config.Annotations[HELLO]")
|
||||||
Expect(value).To(Equal("WORLD"))
|
Expect(value).To(Equal("WORLD"))
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ var _ = Describe("Podman create", func() {
|
|||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("/create/test ro"))
|
Expect(session.OutputToString()).To(ContainSubstring("/create/test ro"))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_shared", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test,shared", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
|
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_shared", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test,shared", mountPath), ALPINE, "awk", `$5 == "/create/test" { print $6 " " $7}`, "/proc/self/mountinfo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
session = podmanTest.Podman([]string{"start", "test_shared"})
|
session = podmanTest.Podman([]string{"start", "test_shared"})
|
||||||
@ -211,10 +211,8 @@ var _ = Describe("Podman create", func() {
|
|||||||
session = podmanTest.Podman([]string{"logs", "test_shared"})
|
session = podmanTest.Podman([]string{"logs", "test_shared"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
found, matches := session.GrepString("/create/test")
|
Expect(session.OutputToString()).To(ContainSubstring("rw"))
|
||||||
Expect(found).Should(BeTrue())
|
Expect(session.OutputToString()).To(ContainSubstring("shared"))
|
||||||
Expect(matches[0]).To(ContainSubstring("rw"))
|
|
||||||
Expect(matches[0]).To(ContainSubstring("shared"))
|
|
||||||
|
|
||||||
mountPath = filepath.Join(podmanTest.TempDir, "scratchpad")
|
mountPath = filepath.Join(podmanTest.TempDir, "scratchpad")
|
||||||
os.Mkdir(mountPath, 0755)
|
os.Mkdir(mountPath, 0755)
|
||||||
@ -263,7 +261,7 @@ var _ = Describe("Podman create", func() {
|
|||||||
session = podmanTest.Podman([]string{"pod", "inspect", podName})
|
session = podmanTest.Podman([]string{"pod", "inspect", podName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
podData := session.InspectPodToJSON()
|
podData := session.InspectPodToJSON()
|
||||||
|
|
||||||
// Finally we can create a container with --pod-id-file and do
|
// Finally we can create a container with --pod-id-file and do
|
||||||
@ -386,12 +384,12 @@ var _ = Describe("Podman create", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"inspect", ctrName})
|
inspect := podmanTest.Podman([]string{"inspect", ctrName})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
data := inspect.InspectContainerToJSON()
|
data := inspect.InspectContainerToJSON()
|
||||||
Expect(len(data)).To(Equal(1))
|
Expect(len(data)).To(Equal(1), "len(InspectContainerToJSON)")
|
||||||
Expect(len(data[0].Config.Labels)).To(Equal(2))
|
Expect(len(data[0].Config.Labels)).To(Equal(2))
|
||||||
_, ok1 := data[0].Config.Labels["TESTKEY1"]
|
_, ok1 := data[0].Config.Labels["TESTKEY1"]
|
||||||
Expect(ok1).To(BeTrue())
|
Expect(ok1).To(BeTrue(), ".Config.Labels[TESTKEY1]")
|
||||||
_, ok2 := data[0].Config.Labels["TESTKEY2"]
|
_, ok2 := data[0].Config.Labels["TESTKEY2"]
|
||||||
Expect(ok2).To(BeTrue())
|
Expect(ok2).To(BeTrue(), ".Config.Labels[TESTKEY2]")
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create with set label", func() {
|
It("podman create with set label", func() {
|
||||||
@ -407,10 +405,10 @@ var _ = Describe("Podman create", func() {
|
|||||||
Expect(len(data)).To(Equal(1))
|
Expect(len(data)).To(Equal(1))
|
||||||
Expect(len(data[0].Config.Labels)).To(Equal(2))
|
Expect(len(data[0].Config.Labels)).To(Equal(2))
|
||||||
val1, ok1 := data[0].Config.Labels["TESTKEY1"]
|
val1, ok1 := data[0].Config.Labels["TESTKEY1"]
|
||||||
Expect(ok1).To(BeTrue())
|
Expect(ok1).To(BeTrue(), ".Config.Labels[TESTKEY1]")
|
||||||
Expect(val1).To(Equal("value1"))
|
Expect(val1).To(Equal("value1"))
|
||||||
val2, ok2 := data[0].Config.Labels["TESTKEY2"]
|
val2, ok2 := data[0].Config.Labels["TESTKEY2"]
|
||||||
Expect(ok2).To(BeTrue())
|
Expect(ok2).To(BeTrue(), ".Config.Labels[TESTKEY2]")
|
||||||
Expect(val2).To(Equal("bar"))
|
Expect(val2).To(Equal("bar"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ var _ = Describe("Podman diff", func() {
|
|||||||
session := podmanTest.Podman([]string{"diff", "--format=json", ALPINE})
|
session := podmanTest.Podman([]string{"diff", "--format=json", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman diff container and committed image", func() {
|
It("podman diff container and committed image", func() {
|
||||||
|
@ -607,7 +607,7 @@ var _ = Describe("Podman generate kube", func() {
|
|||||||
err = yaml.Unmarshal(b, pod)
|
err = yaml.Unmarshal(b, pod)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
val, found := pod.Annotations[define.BindMountPrefix+vol1]
|
val, found := pod.Annotations[define.BindMountPrefix+vol1]
|
||||||
Expect(found).To(BeTrue())
|
Expect(found).To(BeTrue(), "pod.Annotations["+vol1+"]")
|
||||||
Expect(val).To(HaveSuffix("z"))
|
Expect(val).To(HaveSuffix("z"))
|
||||||
|
|
||||||
rm := podmanTest.Podman([]string{"pod", "rm", "-t", "0", "-f", "test1"})
|
rm := podmanTest.Podman([]string{"pod", "rm", "-t", "0", "-f", "test1"})
|
||||||
|
@ -420,7 +420,7 @@ var _ = Describe("Podman generate systemd", func() {
|
|||||||
session := podmanTest.Podman([]string{"generate", "systemd", "--format", "json", "foo"})
|
session := podmanTest.Podman([]string{"generate", "systemd", "--format", "json", "foo"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman generate systemd --new create command with double curly braces", func() {
|
It("podman generate systemd --new create command with double curly braces", func() {
|
||||||
|
@ -89,6 +89,6 @@ var _ = Describe("Podman history", func() {
|
|||||||
session := podmanTest.Podman([]string{"history", "--format=json", ALPINE})
|
session := podmanTest.Podman([]string{"history", "--format=json", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -73,6 +73,6 @@ var _ = Describe("Podman image sign", func() {
|
|||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
fInfos, err := ioutil.ReadDir(filepath.Join(sigDir, "library"))
|
fInfos, err := ioutil.ReadDir(filepath.Join(sigDir, "library"))
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
Expect(len(fInfos) > 1).To(BeTrue())
|
Expect(len(fInfos)).To(BeNumerically(">", 1), "len(fInfos)")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -94,14 +94,14 @@ var _ = Describe("Podman images", func() {
|
|||||||
session := podmanTest.Podman([]string{"images", "--format=json", "not-existing-image"})
|
session := podmanTest.Podman([]string{"images", "--format=json", "not-existing-image"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman images in JSON format", func() {
|
It("podman images in JSON format", func() {
|
||||||
session := podmanTest.Podman([]string{"images", "--format=json"})
|
session := podmanTest.Podman([]string{"images", "--format=json"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman images in GO template format", func() {
|
It("podman images in GO template format", func() {
|
||||||
@ -254,7 +254,7 @@ WORKDIR /test
|
|||||||
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
|
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
imageData := session.InspectImageJSON()
|
imageData := session.InspectImageJSON()
|
||||||
|
|
||||||
result := podmanTest.Podman([]string{"images", "sha256:" + imageData[0].ID})
|
result := podmanTest.Podman([]string{"images", "sha256:" + imageData[0].ID})
|
||||||
@ -266,7 +266,7 @@ WORKDIR /test
|
|||||||
session := podmanTest.Podman([]string{"image", "inspect", "--format=json", ALPINE})
|
session := podmanTest.Podman([]string{"image", "inspect", "--format=json", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
imageData := session.InspectImageJSON()
|
imageData := session.InspectImageJSON()
|
||||||
|
|
||||||
result := podmanTest.Podman([]string{"image", "ls", fmt.Sprintf("sha256:%s", imageData[0].ID)})
|
result := podmanTest.Podman([]string{"image", "ls", fmt.Sprintf("sha256:%s", imageData[0].ID)})
|
||||||
|
@ -38,7 +38,7 @@ var _ = Describe("Podman inspect", func() {
|
|||||||
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
|
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
imageData := session.InspectImageJSON()
|
imageData := session.InspectImageJSON()
|
||||||
Expect(imageData[0].RepoTags[0]).To(Equal("quay.io/libpod/alpine:latest"))
|
Expect(imageData[0].RepoTags[0]).To(Equal("quay.io/libpod/alpine:latest"))
|
||||||
})
|
})
|
||||||
@ -314,7 +314,7 @@ var _ = Describe("Podman inspect", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"inspect", podName})
|
inspect := podmanTest.Podman([]string{"inspect", podName})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect.OutputToString()).To(BeValidJSON())
|
||||||
podData := inspect.InspectPodArrToJSON()
|
podData := inspect.InspectPodArrToJSON()
|
||||||
Expect(podData[0].Name).To(Equal(podName))
|
Expect(podData[0].Name).To(Equal(podName))
|
||||||
})
|
})
|
||||||
@ -328,7 +328,7 @@ var _ = Describe("Podman inspect", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
|
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect.OutputToString()).To(BeValidJSON())
|
||||||
podData := inspect.InspectPodArrToJSON()
|
podData := inspect.InspectPodArrToJSON()
|
||||||
Expect(podData[0].Name).To(Equal(podName))
|
Expect(podData[0].Name).To(Equal(podName))
|
||||||
})
|
})
|
||||||
@ -343,7 +343,7 @@ var _ = Describe("Podman inspect", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", "--latest"})
|
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", "--latest"})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect.OutputToString()).To(BeValidJSON())
|
||||||
podData := inspect.InspectPodArrToJSON()
|
podData := inspect.InspectPodArrToJSON()
|
||||||
Expect(podData[0].Name).To(Equal(podName))
|
Expect(podData[0].Name).To(Equal(podName))
|
||||||
})
|
})
|
||||||
@ -357,14 +357,14 @@ var _ = Describe("Podman inspect", func() {
|
|||||||
inspect1 := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
|
inspect1 := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
|
||||||
inspect1.WaitWithDefaultTimeout()
|
inspect1.WaitWithDefaultTimeout()
|
||||||
Expect(inspect1).Should(Exit(0))
|
Expect(inspect1).Should(Exit(0))
|
||||||
Expect(inspect1.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect1.OutputToString()).To(BeValidJSON())
|
||||||
podData := inspect1.InspectPodArrToJSON()
|
podData := inspect1.InspectPodArrToJSON()
|
||||||
infra := podData[0].Containers[0].Name
|
infra := podData[0].Containers[0].Name
|
||||||
|
|
||||||
inspect := podmanTest.Podman([]string{"inspect", "--latest"})
|
inspect := podmanTest.Podman([]string{"inspect", "--latest"})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect.OutputToString()).To(BeValidJSON())
|
||||||
containerData := inspect.InspectContainerToJSON()
|
containerData := inspect.InspectContainerToJSON()
|
||||||
Expect(containerData[0].Name).To(Equal(infra))
|
Expect(containerData[0].Name).To(Equal(infra))
|
||||||
})
|
})
|
||||||
@ -388,7 +388,7 @@ var _ = Describe("Podman inspect", func() {
|
|||||||
session = podmanTest.Podman([]string{"inspect", volName})
|
session = podmanTest.Podman([]string{"inspect", volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman inspect a volume with --format", func() {
|
It("podman inspect a volume with --format", func() {
|
||||||
|
@ -221,7 +221,7 @@ var _ = Describe("Podman load", func() {
|
|||||||
|
|
||||||
result := podmanTest.Podman([]string{"images", "hello:world"})
|
result := podmanTest.Podman([]string{"images", "hello:world"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
|
Expect(result.OutputToString()).To(Not(ContainSubstring("docker")))
|
||||||
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
|
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ var _ = Describe("Podman load", func() {
|
|||||||
|
|
||||||
result := podmanTest.Podman([]string{"images", "hello:latest"})
|
result := podmanTest.Podman([]string{"images", "hello:latest"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
|
Expect(result.OutputToString()).To(Not(ContainSubstring("docker")))
|
||||||
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
|
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ var _ = Describe("Podman load", func() {
|
|||||||
|
|
||||||
result := podmanTest.Podman([]string{"images", "load:latest"})
|
result := podmanTest.Podman([]string{"images", "load:latest"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
|
Expect(result.OutputToString()).To(Not(ContainSubstring("docker")))
|
||||||
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
|
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ var _ = Describe("Podman mount", func() {
|
|||||||
j := podmanTest.Podman([]string{"mount", "--format=json"})
|
j := podmanTest.Podman([]string{"mount", "--format=json"})
|
||||||
j.WaitWithDefaultTimeout()
|
j.WaitWithDefaultTimeout()
|
||||||
Expect(j).Should(Exit(0))
|
Expect(j).Should(Exit(0))
|
||||||
Expect(j.IsJSONOutputValid()).To(BeTrue())
|
Expect(j.OutputToString()).To(BeValidJSON())
|
||||||
|
|
||||||
j = podmanTest.Podman([]string{"mount", "--format='{{.foobar}}'"})
|
j = podmanTest.Podman([]string{"mount", "--format='{{.foobar}}'"})
|
||||||
j.WaitWithDefaultTimeout()
|
j.WaitWithDefaultTimeout()
|
||||||
@ -332,7 +332,7 @@ var _ = Describe("Podman mount", func() {
|
|||||||
j := podmanTest.Podman([]string{"image", "mount", "--format=json"})
|
j := podmanTest.Podman([]string{"image", "mount", "--format=json"})
|
||||||
j.WaitWithDefaultTimeout()
|
j.WaitWithDefaultTimeout()
|
||||||
Expect(j).Should(Exit(0))
|
Expect(j).Should(Exit(0))
|
||||||
Expect(j.IsJSONOutputValid()).To(BeTrue())
|
Expect(j.OutputToString()).To(BeValidJSON())
|
||||||
|
|
||||||
umount := podmanTest.Podman([]string{"image", "umount", fedoraMinimal})
|
umount := podmanTest.Podman([]string{"image", "umount", fedoraMinimal})
|
||||||
umount.WaitWithDefaultTimeout()
|
umount.WaitWithDefaultTimeout()
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/podman/v3/libpod/network/types"
|
"github.com/containers/podman/v3/libpod/network/types"
|
||||||
@ -234,7 +233,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
session := podmanTest.Podman(append([]string{"network", "inspect"}, expectedNetworks...))
|
session := podmanTest.Podman(append([]string{"network", "inspect"}, expectedNetworks...))
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman network inspect", func() {
|
It("podman network inspect", func() {
|
||||||
@ -269,7 +268,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
Expect(ok).To(BeTrue())
|
Expect(ok).To(BeTrue())
|
||||||
Expect(net.NetworkID).To(Equal(netName))
|
Expect(net.NetworkID).To(Equal(netName))
|
||||||
Expect(net.IPPrefixLen).To(Equal(24))
|
Expect(net.IPPrefixLen).To(Equal(24))
|
||||||
Expect(strings.HasPrefix(net.IPAddress, "10.50.50.")).To(BeTrue())
|
Expect(net.IPAddress).To(HavePrefix("10.50.50."))
|
||||||
|
|
||||||
// Necessary to ensure the CNI network is removed cleanly
|
// Necessary to ensure the CNI network is removed cleanly
|
||||||
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
|
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
|
||||||
@ -342,12 +341,12 @@ var _ = Describe("Podman network", func() {
|
|||||||
Expect(ok).To(BeTrue())
|
Expect(ok).To(BeTrue())
|
||||||
Expect(net1.NetworkID).To(Equal(netName1))
|
Expect(net1.NetworkID).To(Equal(netName1))
|
||||||
Expect(net1.IPPrefixLen).To(Equal(25))
|
Expect(net1.IPPrefixLen).To(Equal(25))
|
||||||
Expect(strings.HasPrefix(net1.IPAddress, "10.50.51.")).To(BeTrue())
|
Expect(net1.IPAddress).To(HavePrefix("10.50.51."))
|
||||||
net2, ok := conData[0].NetworkSettings.Networks[netName2]
|
net2, ok := conData[0].NetworkSettings.Networks[netName2]
|
||||||
Expect(ok).To(BeTrue())
|
Expect(ok).To(BeTrue())
|
||||||
Expect(net2.NetworkID).To(Equal(netName2))
|
Expect(net2.NetworkID).To(Equal(netName2))
|
||||||
Expect(net2.IPPrefixLen).To(Equal(26))
|
Expect(net2.IPPrefixLen).To(Equal(26))
|
||||||
Expect(strings.HasPrefix(net2.IPAddress, "10.50.51.")).To(BeTrue())
|
Expect(net2.IPAddress).To(HavePrefix("10.50.51."))
|
||||||
|
|
||||||
// Necessary to ensure the CNI network is removed cleanly
|
// Necessary to ensure the CNI network is removed cleanly
|
||||||
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
|
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
|
||||||
|
@ -173,7 +173,7 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/hosts"})
|
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/hosts"})
|
||||||
podResolvConf.WaitWithDefaultTimeout()
|
podResolvConf.WaitWithDefaultTimeout()
|
||||||
Expect(podResolvConf).Should(Exit(0))
|
Expect(podResolvConf).Should(Exit(0))
|
||||||
Expect(strings.Contains(podResolvConf.OutputToString(), "12.34.56.78 test.example.com")).To(BeTrue())
|
Expect(podResolvConf.OutputToString()).To(ContainSubstring("12.34.56.78 test.example.com"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create pod with --add-host and no infra should fail", func() {
|
It("podman create pod with --add-host and no infra should fail", func() {
|
||||||
@ -193,7 +193,7 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
|
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
|
||||||
podResolvConf.WaitWithDefaultTimeout()
|
podResolvConf.WaitWithDefaultTimeout()
|
||||||
Expect(podResolvConf).Should(Exit(0))
|
Expect(podResolvConf).Should(Exit(0))
|
||||||
Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("nameserver %s", server))).To(BeTrue())
|
Expect(podResolvConf.OutputToString()).To(ContainSubstring("nameserver %s", server))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create pod with DNS server set and no infra should fail", func() {
|
It("podman create pod with DNS server set and no infra should fail", func() {
|
||||||
@ -214,7 +214,7 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
|
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
|
||||||
podResolvConf.WaitWithDefaultTimeout()
|
podResolvConf.WaitWithDefaultTimeout()
|
||||||
Expect(podResolvConf).Should(Exit(0))
|
Expect(podResolvConf).Should(Exit(0))
|
||||||
Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("options %s", option))).To(BeTrue())
|
Expect(podResolvConf.OutputToString()).To(ContainSubstring(fmt.Sprintf("options %s", option)))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create pod with DNS option set and no infra should fail", func() {
|
It("podman create pod with DNS option set and no infra should fail", func() {
|
||||||
@ -235,7 +235,7 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
|
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
|
||||||
podResolvConf.WaitWithDefaultTimeout()
|
podResolvConf.WaitWithDefaultTimeout()
|
||||||
Expect(podResolvConf).Should(Exit(0))
|
Expect(podResolvConf).Should(Exit(0))
|
||||||
Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("search %s", search))).To(BeTrue())
|
Expect(podResolvConf.OutputToString()).To(ContainSubstring(fmt.Sprintf("search %s", search)))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create pod with DNS search domain set and no infra should fail", func() {
|
It("podman create pod with DNS search domain set and no infra should fail", func() {
|
||||||
@ -259,7 +259,7 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"})
|
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"})
|
||||||
podResolvConf.WaitWithDefaultTimeout()
|
podResolvConf.WaitWithDefaultTimeout()
|
||||||
Expect(podResolvConf).Should(Exit(0))
|
Expect(podResolvConf).Should(Exit(0))
|
||||||
Expect(strings.Contains(podResolvConf.OutputToString(), ip)).To(BeTrue())
|
Expect(podResolvConf.OutputToString()).To(ContainSubstring(ip))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"})
|
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"})
|
||||||
podResolvConf.WaitWithDefaultTimeout()
|
podResolvConf.WaitWithDefaultTimeout()
|
||||||
Expect(podResolvConf).Should(Exit(0))
|
Expect(podResolvConf).Should(Exit(0))
|
||||||
Expect(strings.Contains(podResolvConf.OutputToString(), mac)).To(BeTrue())
|
Expect(podResolvConf.OutputToString()).To(ContainSubstring(mac))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ entrypoint ["/fromimage"]
|
|||||||
status1 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
|
status1 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
|
||||||
status1.WaitWithDefaultTimeout()
|
status1.WaitWithDefaultTimeout()
|
||||||
Expect(status1).Should(Exit(0))
|
Expect(status1).Should(Exit(0))
|
||||||
Expect(strings.Contains(status1.OutputToString(), "Created")).To(BeTrue())
|
Expect(status1.OutputToString()).To(ContainSubstring("Created"))
|
||||||
|
|
||||||
ctr1 := podmanTest.Podman([]string{"run", "--pod", podName, "-d", ALPINE, "top"})
|
ctr1 := podmanTest.Podman([]string{"run", "--pod", podName, "-d", ALPINE, "top"})
|
||||||
ctr1.WaitWithDefaultTimeout()
|
ctr1.WaitWithDefaultTimeout()
|
||||||
@ -483,7 +483,7 @@ entrypoint ["/fromimage"]
|
|||||||
status2 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
|
status2 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
|
||||||
status2.WaitWithDefaultTimeout()
|
status2.WaitWithDefaultTimeout()
|
||||||
Expect(status2).Should(Exit(0))
|
Expect(status2).Should(Exit(0))
|
||||||
Expect(strings.Contains(status2.OutputToString(), "Running")).To(BeTrue())
|
Expect(status2.OutputToString()).To(ContainSubstring("Running"))
|
||||||
|
|
||||||
ctr2 := podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
|
ctr2 := podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
|
||||||
ctr2.WaitWithDefaultTimeout()
|
ctr2.WaitWithDefaultTimeout()
|
||||||
@ -492,7 +492,7 @@ entrypoint ["/fromimage"]
|
|||||||
status3 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
|
status3 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
|
||||||
status3.WaitWithDefaultTimeout()
|
status3.WaitWithDefaultTimeout()
|
||||||
Expect(status3).Should(Exit(0))
|
Expect(status3).Should(Exit(0))
|
||||||
Expect(strings.Contains(status3.OutputToString(), "Degraded")).To(BeTrue())
|
Expect(status3.OutputToString()).To(ContainSubstring("Degraded"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create with unsupported network options", func() {
|
It("podman create with unsupported network options", func() {
|
||||||
@ -725,7 +725,7 @@ ENTRYPOINT ["sleep","99999"]
|
|||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
l := session.OutputToString()
|
l := session.OutputToString()
|
||||||
Expect(strings.Contains(l, "1024")).To(BeTrue())
|
Expect(l).To(ContainSubstring("1024"))
|
||||||
m[l] = l
|
m[l] = l
|
||||||
}
|
}
|
||||||
// check for no duplicates
|
// check for no duplicates
|
||||||
|
@ -56,7 +56,7 @@ var _ = Describe("Podman pod inspect", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"pod", "inspect", podid})
|
inspect := podmanTest.Podman([]string{"pod", "inspect", podid})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect.OutputToString()).To(BeValidJSON())
|
||||||
podData := inspect.InspectPodToJSON()
|
podData := inspect.InspectPodToJSON()
|
||||||
Expect(podData.ID).To(Equal(podid))
|
Expect(podData.ID).To(Equal(podid))
|
||||||
})
|
})
|
||||||
@ -75,7 +75,7 @@ var _ = Describe("Podman pod inspect", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"pod", "inspect", podName})
|
inspect := podmanTest.Podman([]string{"pod", "inspect", podName})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect.OutputToString()).To(BeValidJSON())
|
||||||
podData := inspect.InspectPodToJSON()
|
podData := inspect.InspectPodToJSON()
|
||||||
// Let's get the last len(createCommand) items in the command.
|
// Let's get the last len(createCommand) items in the command.
|
||||||
inspectCreateCommand := podData.CreateCommand
|
inspectCreateCommand := podData.CreateCommand
|
||||||
|
@ -149,7 +149,7 @@ var _ = Describe("Podman pod stats", func() {
|
|||||||
stats := podmanTest.Podman([]string{"pod", "stats", "--format", "json", "--no-stream", "-a"})
|
stats := podmanTest.Podman([]string{"pod", "stats", "--format", "json", "--no-stream", "-a"})
|
||||||
stats.WaitWithDefaultTimeout()
|
stats.WaitWithDefaultTimeout()
|
||||||
Expect(stats).Should(Exit(0))
|
Expect(stats).Should(Exit(0))
|
||||||
Expect(stats.IsJSONOutputValid()).To(BeTrue())
|
Expect(stats.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
It("podman pod stats with GO template", func() {
|
It("podman pod stats with GO template", func() {
|
||||||
_, ec, podid := podmanTest.CreatePod(nil)
|
_, ec, podid := podmanTest.CreatePod(nil)
|
||||||
@ -189,6 +189,6 @@ var _ = Describe("Podman pod stats", func() {
|
|||||||
stats := podmanTest.Podman([]string{"pod", "stats", "--format", "json", "--no-stream", podName})
|
stats := podmanTest.Podman([]string{"pod", "stats", "--format", "json", "--no-stream", podName})
|
||||||
stats.WaitWithDefaultTimeout()
|
stats.WaitWithDefaultTimeout()
|
||||||
Expect(stats).Should(Exit(0))
|
Expect(stats).Should(Exit(0))
|
||||||
Expect(stats.IsJSONOutputValid()).To(BeTrue())
|
Expect(stats.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -239,7 +239,7 @@ var _ = Describe("Podman ps", func() {
|
|||||||
result := podmanTest.Podman([]string{"ps", "--format", "json"})
|
result := podmanTest.Podman([]string{"ps", "--format", "json"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
Expect(result.IsJSONOutputValid()).To(BeTrue())
|
Expect(result.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ps namespace flag with json format", func() {
|
It("podman ps namespace flag with json format", func() {
|
||||||
@ -249,7 +249,7 @@ var _ = Describe("Podman ps", func() {
|
|||||||
result := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "json"})
|
result := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "json"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
Expect(result.IsJSONOutputValid()).To(BeTrue())
|
Expect(result.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ps json format Created field is int64", func() {
|
It("podman ps json format Created field is int64", func() {
|
||||||
@ -275,7 +275,7 @@ var _ = Describe("Podman ps", func() {
|
|||||||
result := podmanTest.Podman([]string{"ps", "-a", "--format", "json"})
|
result := podmanTest.Podman([]string{"ps", "-a", "--format", "json"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
Expect(result.IsJSONOutputValid()).To(BeTrue())
|
Expect(result.OutputToString()).To(BeValidJSON())
|
||||||
// must contain "Status"
|
// must contain "Status"
|
||||||
match, StatusLine := result.GrepString(`Status`)
|
match, StatusLine := result.GrepString(`Status`)
|
||||||
Expect(match).To(BeTrue())
|
Expect(match).To(BeTrue())
|
||||||
|
@ -758,7 +758,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||||||
run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"})
|
run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(Exit(0))
|
||||||
Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
|
Expect(run.OutputToString()).To(ContainSubstring(hostname))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run with --net=none sets hostname", func() {
|
It("podman run with --net=none sets hostname", func() {
|
||||||
@ -766,7 +766,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||||||
run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "hostname"})
|
run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "hostname"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(Exit(0))
|
||||||
Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
|
Expect(run.OutputToString()).To(ContainSubstring(hostname))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run with --net=none adds hostname to /etc/hosts", func() {
|
It("podman run with --net=none adds hostname to /etc/hosts", func() {
|
||||||
@ -774,7 +774,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
|||||||
run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "cat", "/etc/hosts"})
|
run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "cat", "/etc/hosts"})
|
||||||
run.WaitWithDefaultTimeout()
|
run.WaitWithDefaultTimeout()
|
||||||
Expect(run).Should(Exit(0))
|
Expect(run).Should(Exit(0))
|
||||||
Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
|
Expect(run.OutputToString()).To(ContainSubstring(hostname))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run with pod does not add extra 127 entry to /etc/hosts", func() {
|
It("podman run with pod does not add extra 127 entry to /etc/hosts", func() {
|
||||||
|
@ -1518,7 +1518,7 @@ USER mail`, BB)
|
|||||||
session := podmanTest.Podman([]string{"run", "-t", "-i", "--group-add", groupName, "--privileged", fedoraMinimal, "groups"})
|
session := podmanTest.Podman([]string{"run", "-t", "-i", "--group-add", groupName, "--privileged", fedoraMinimal, "groups"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(strings.Contains(session.OutputToString(), groupName)).To(BeTrue())
|
Expect(session.OutputToString()).To(ContainSubstring(groupName))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run --tz", func() {
|
It("podman run --tz", func() {
|
||||||
|
@ -153,7 +153,7 @@ var _ = Describe("Podman UserNS support", func() {
|
|||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
l := session.OutputToString()
|
l := session.OutputToString()
|
||||||
Expect(strings.Contains(l, "1024")).To(BeTrue())
|
Expect(l).To(ContainSubstring("1024"))
|
||||||
m[l] = l
|
m[l] = l
|
||||||
}
|
}
|
||||||
// check for no duplicates
|
// check for no duplicates
|
||||||
|
@ -287,7 +287,7 @@ var _ = Describe("Podman run with volumes", func() {
|
|||||||
os.Stderr.Sync()
|
os.Stderr.Sync()
|
||||||
mountOut1 := strings.Join(strings.Fields(string(mountCmd1.Out.Contents())), " ")
|
mountOut1 := strings.Join(strings.Fields(string(mountCmd1.Out.Contents())), " ")
|
||||||
fmt.Printf("Output: %s", mountOut1)
|
fmt.Printf("Output: %s", mountOut1)
|
||||||
Expect(strings.Contains(mountOut1, volName)).To(BeFalse())
|
Expect(mountOut1).To(Not(ContainSubstring(volName)))
|
||||||
|
|
||||||
ctrName := "testctr"
|
ctrName := "testctr"
|
||||||
podmanSession := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, "-v", fmt.Sprintf("%s:/testvol", volName), ALPINE, "top"})
|
podmanSession := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, "-v", fmt.Sprintf("%s:/testvol", volName), ALPINE, "top"})
|
||||||
@ -303,7 +303,7 @@ var _ = Describe("Podman run with volumes", func() {
|
|||||||
os.Stderr.Sync()
|
os.Stderr.Sync()
|
||||||
mountOut2 := strings.Join(strings.Fields(string(mountCmd2.Out.Contents())), " ")
|
mountOut2 := strings.Join(strings.Fields(string(mountCmd2.Out.Contents())), " ")
|
||||||
fmt.Printf("Output: %s", mountOut2)
|
fmt.Printf("Output: %s", mountOut2)
|
||||||
Expect(strings.Contains(mountOut2, volName)).To(BeTrue())
|
Expect(mountOut2).To(ContainSubstring(volName))
|
||||||
|
|
||||||
// Stop the container to unmount
|
// Stop the container to unmount
|
||||||
podmanStopSession := podmanTest.Podman([]string{"stop", "--time", "0", ctrName})
|
podmanStopSession := podmanTest.Podman([]string{"stop", "--time", "0", ctrName})
|
||||||
@ -324,7 +324,7 @@ var _ = Describe("Podman run with volumes", func() {
|
|||||||
os.Stderr.Sync()
|
os.Stderr.Sync()
|
||||||
mountOut3 := strings.Join(strings.Fields(string(mountCmd3.Out.Contents())), " ")
|
mountOut3 := strings.Join(strings.Fields(string(mountCmd3.Out.Contents())), " ")
|
||||||
fmt.Printf("Output: %s", mountOut3)
|
fmt.Printf("Output: %s", mountOut3)
|
||||||
Expect(strings.Contains(mountOut3, volName)).To(BeFalse())
|
Expect(mountOut3).To(Not(ContainSubstring(volName)))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman named volume copyup", func() {
|
It("podman named volume copyup", func() {
|
||||||
@ -516,7 +516,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
|
|||||||
Expect(runLs).Should(Exit(0))
|
Expect(runLs).Should(Exit(0))
|
||||||
outputArr := runLs.OutputToStringArray()
|
outputArr := runLs.OutputToStringArray()
|
||||||
Expect(len(outputArr)).To(Equal(1))
|
Expect(len(outputArr)).To(Equal(1))
|
||||||
Expect(strings.Contains(outputArr[0], fileName)).To(BeTrue())
|
Expect(outputArr[0]).To(ContainSubstring(fileName))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("Podman mount over image volume with trailing /", func() {
|
It("Podman mount over image volume with trailing /", func() {
|
||||||
@ -752,7 +752,7 @@ USER testuser`, fedoraMinimal)
|
|||||||
test1 := podmanTest.Podman([]string{"run", "-v", "testvol1:/test", imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
|
test1 := podmanTest.Podman([]string{"run", "-v", "testvol1:/test", imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
|
||||||
test1.WaitWithDefaultTimeout()
|
test1.WaitWithDefaultTimeout()
|
||||||
Expect(test1).Should(Exit(0))
|
Expect(test1).Should(Exit(0))
|
||||||
Expect(strings.Contains(test1.OutputToString(), testString)).To(BeTrue())
|
Expect(test1.OutputToString()).To(ContainSubstring(testString))
|
||||||
|
|
||||||
volName := "testvol2"
|
volName := "testvol2"
|
||||||
vol := podmanTest.Podman([]string{"volume", "create", volName})
|
vol := podmanTest.Podman([]string{"volume", "create", volName})
|
||||||
@ -762,7 +762,7 @@ USER testuser`, fedoraMinimal)
|
|||||||
test2 := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
|
test2 := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
|
||||||
test2.WaitWithDefaultTimeout()
|
test2.WaitWithDefaultTimeout()
|
||||||
Expect(test2).Should(Exit(0))
|
Expect(test2).Should(Exit(0))
|
||||||
Expect(strings.Contains(test2.OutputToString(), testString)).To(BeTrue())
|
Expect(test2.OutputToString()).To(ContainSubstring(testString))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -94,14 +94,14 @@ var _ = Describe("podman container runlabel", func() {
|
|||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).To(ExitWithError())
|
Expect(result).To(ExitWithError())
|
||||||
// should not panic when label missing the value or don't have the label
|
// should not panic when label missing the value or don't have the label
|
||||||
Expect(result.LineInOutputContains("panic")).NotTo(BeTrue())
|
Expect(result.OutputToString()).To(Not(ContainSubstring("panic")))
|
||||||
})
|
})
|
||||||
It("podman container runlabel bogus label in remote image should result in non-zero exit", func() {
|
It("podman container runlabel bogus label in remote image should result in non-zero exit", func() {
|
||||||
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", "docker.io/library/ubuntu:latest"})
|
result := podmanTest.Podman([]string{"container", "runlabel", "RUN", "docker.io/library/ubuntu:latest"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).To(ExitWithError())
|
Expect(result).To(ExitWithError())
|
||||||
// should not panic when label missing the value or don't have the label
|
// should not panic when label missing the value or don't have the label
|
||||||
Expect(result.LineInOutputContains("panic")).NotTo(BeTrue())
|
Expect(result.OutputToString()).To(Not(ContainSubstring("panic")))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman container runlabel global options", func() {
|
It("podman container runlabel global options", func() {
|
||||||
|
@ -134,7 +134,7 @@ registries = ['{{.Host}}:{{.Port}}']`
|
|||||||
search := podmanTest.Podman([]string{"search", "--format", "json", "alpine"})
|
search := podmanTest.Podman([]string{"search", "--format", "json", "alpine"})
|
||||||
search.WaitWithDefaultTimeout()
|
search.WaitWithDefaultTimeout()
|
||||||
Expect(search).Should(Exit(0))
|
Expect(search).Should(Exit(0))
|
||||||
Expect(search.IsJSONOutputValid()).To(BeTrue())
|
Expect(search.OutputToString()).To(BeValidJSON())
|
||||||
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
|
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
|
||||||
|
|
||||||
// Test for https://github.com/containers/podman/issues/11894
|
// Test for https://github.com/containers/podman/issues/11894
|
||||||
@ -151,7 +151,7 @@ registries = ['{{.Host}}:{{.Port}}']`
|
|||||||
search := podmanTest.Podman([]string{"search", "--list-tags", "--format", "json", "alpine"})
|
search := podmanTest.Podman([]string{"search", "--list-tags", "--format", "json", "alpine"})
|
||||||
search.WaitWithDefaultTimeout()
|
search.WaitWithDefaultTimeout()
|
||||||
Expect(search).Should(Exit(0))
|
Expect(search).Should(Exit(0))
|
||||||
Expect(search.IsJSONOutputValid()).To(BeTrue())
|
Expect(search.OutputToString()).To(BeValidJSON())
|
||||||
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
|
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
|
||||||
Expect(search.OutputToString()).To(ContainSubstring("3.10"))
|
Expect(search.OutputToString()).To(ContainSubstring("3.10"))
|
||||||
Expect(search.OutputToString()).To(ContainSubstring("2.7"))
|
Expect(search.OutputToString()).To(ContainSubstring("2.7"))
|
||||||
|
@ -78,7 +78,7 @@ var _ = Describe("Podman secret", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"secret", "inspect", secrID})
|
inspect := podmanTest.Podman([]string{"secret", "inspect", secrID})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman secret inspect with --format", func() {
|
It("podman secret inspect with --format", func() {
|
||||||
@ -115,7 +115,7 @@ var _ = Describe("Podman secret", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"secret", "inspect", secrID, secrID2})
|
inspect := podmanTest.Podman([]string{"secret", "inspect", secrID, secrID2})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
|
Expect(inspect.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman secret inspect bogus", func() {
|
It("podman secret inspect bogus", func() {
|
||||||
|
@ -148,7 +148,7 @@ var _ = Describe("Podman stats", func() {
|
|||||||
stats := podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "json"})
|
stats := podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "json"})
|
||||||
stats.WaitWithDefaultTimeout()
|
stats.WaitWithDefaultTimeout()
|
||||||
Expect(stats).Should(Exit(0))
|
Expect(stats).Should(Exit(0))
|
||||||
Expect(stats.IsJSONOutputValid()).To(BeTrue())
|
Expect(stats.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman stats on a container with no net ns", func() {
|
It("podman stats on a container with no net ns", func() {
|
||||||
|
@ -93,7 +93,7 @@ WantedBy=default.target
|
|||||||
systemctl := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "systemctl", "status", "--no-pager"})
|
systemctl := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "systemctl", "status", "--no-pager"})
|
||||||
systemctl.WaitWithDefaultTimeout()
|
systemctl.WaitWithDefaultTimeout()
|
||||||
Expect(systemctl).Should(Exit(0))
|
Expect(systemctl).Should(Exit(0))
|
||||||
Expect(strings.Contains(systemctl.OutputToString(), "State:")).To(BeTrue())
|
Expect(systemctl.OutputToString()).To(ContainSubstring("State:"))
|
||||||
|
|
||||||
result := podmanTest.Podman([]string{"inspect", ctrName})
|
result := podmanTest.Podman([]string{"inspect", ctrName})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
|
@ -76,7 +76,7 @@ var _ = Describe("Podman trust", func() {
|
|||||||
session := podmanTest.Podman([]string{"image", "trust", "show", "--registrypath", filepath.Join(INTEGRATION_ROOT, "test"), "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json"), "--json"})
|
session := podmanTest.Podman([]string{"image", "trust", "show", "--registrypath", filepath.Join(INTEGRATION_ROOT, "test"), "--policypath", filepath.Join(INTEGRATION_ROOT, "test/policy.json"), "--json"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
var teststruct []map[string]string
|
var teststruct []map[string]string
|
||||||
json.Unmarshal(session.Out.Contents(), &teststruct)
|
json.Unmarshal(session.Out.Contents(), &teststruct)
|
||||||
Expect(len(teststruct)).To(Equal(3))
|
Expect(len(teststruct)).To(Equal(3))
|
||||||
@ -118,7 +118,7 @@ var _ = Describe("Podman trust", func() {
|
|||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
contents, err := ioutil.ReadFile(filepath.Join(INTEGRATION_ROOT, "test/policy.json"))
|
contents, err := ioutil.ReadFile(filepath.Join(INTEGRATION_ROOT, "test/policy.json"))
|
||||||
Expect(err).ShouldNot(HaveOccurred())
|
Expect(err).ShouldNot(HaveOccurred())
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
Expect(string(session.Out.Contents())).To(Equal(string(contents) + "\n"))
|
Expect(string(session.Out.Contents())).To(Equal(string(contents) + "\n"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -2,7 +2,6 @@ package integration
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
. "github.com/containers/podman/v3/test/utils"
|
. "github.com/containers/podman/v3/test/utils"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
@ -43,7 +42,7 @@ var _ = Describe("Podman volume inspect", func() {
|
|||||||
session = podmanTest.Podman([]string{"volume", "inspect", volName})
|
session = podmanTest.Podman([]string{"volume", "inspect", volName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman inspect volume with Go format", func() {
|
It("podman inspect volume with Go format", func() {
|
||||||
@ -86,6 +85,6 @@ var _ = Describe("Podman volume inspect", func() {
|
|||||||
inspect := podmanTest.Podman([]string{"volume", "inspect", volName})
|
inspect := podmanTest.Podman([]string{"volume", "inspect", volName})
|
||||||
inspect.WaitWithDefaultTimeout()
|
inspect.WaitWithDefaultTimeout()
|
||||||
Expect(inspect).Should(Exit(0))
|
Expect(inspect).Should(Exit(0))
|
||||||
Expect(strings.Contains(inspect.OutputToString(), "tmpfs")).To(BeTrue())
|
Expect(inspect.OutputToString()).To(ContainSubstring("tmpfs"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -64,7 +64,7 @@ var _ = Describe("Podman volume ls", func() {
|
|||||||
session = podmanTest.Podman([]string{"volume", "ls", "--format", "json"})
|
session = podmanTest.Podman([]string{"volume", "ls", "--format", "json"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.IsJSONOutputValid()).To(BeTrue())
|
Expect(session.OutputToString()).To(BeValidJSON())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman ls volume with Go template", func() {
|
It("podman ls volume with Go template", func() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
@ -166,3 +167,32 @@ func (matcher *ExitMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ValidJSONMatcher struct {
|
||||||
|
types.GomegaMatcher
|
||||||
|
}
|
||||||
|
|
||||||
|
func BeValidJSON() *ValidJSONMatcher {
|
||||||
|
return &ValidJSONMatcher{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (matcher *ValidJSONMatcher) Match(actual interface{}) (success bool, err error) {
|
||||||
|
s, ok := actual.(string)
|
||||||
|
if !ok {
|
||||||
|
return false, fmt.Errorf("ValidJSONMatcher expects a string, not %q", actual)
|
||||||
|
}
|
||||||
|
|
||||||
|
var i interface{}
|
||||||
|
if err := json.Unmarshal([]byte(s), &i); err != nil {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (matcher *ValidJSONMatcher) FailureMessage(actual interface{}) (message string) {
|
||||||
|
return format.Message(actual, "to be valid JSON")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (matcher *ValidJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||||
|
return format.Message(actual, "to _not_ be valid JSON")
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user