Skip to content

Commit

Permalink
Merge pull request #12454 from edsantiago/remove_betrue
Browse files Browse the repository at this point in the history
More BeTrue cleanup
  • Loading branch information
openshift-merge-robot authored Nov 30, 2021
2 parents 85101f6 + 8eb0be0 commit 295a6f7
Show file tree
Hide file tree
Showing 31 changed files with 113 additions and 90 deletions.
11 changes: 4 additions & 7 deletions test/e2e/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,10 @@ subdir**`
session := podmanTest.Podman([]string{"build", "-t", "test", "."})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
ok, _ := session.GrepString("/testfilter/dummy1")
Expect(ok).NotTo(BeTrue())
Expect(session.OutputToString()).To(ContainSubstring("/testfilter/dummy2"))
ok, _ = session.GrepString("/testfilter/subdir")
Expect(ok).NotTo(BeTrue()) //.dockerignore filters both subdir and inside subdir
ok, _ = session.GrepString("/testfilter/subdir/dummy3")
Expect(ok).NotTo(BeTrue())
output := session.OutputToString()
Expect(output).To(ContainSubstring("/testfilter/dummy2"))
Expect(output).NotTo(ContainSubstring("/testfilter/dummy1"))
Expect(output).NotTo(ContainSubstring("/testfilter/subdir"))
})

It("podman remote test context dir contains empty dirs and symlinks", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ var _ = Describe("Podman checkpoint", func() {
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
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.WaitWithDefaultTimeout()
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ var _ = Describe("Podman commit", func() {
Expect(inspect).Should(Exit(0))
image := inspect.InspectImageJSON()
_, ok := image[0].Config.Volumes["/foo"]
Expect(ok).To(BeTrue())
Expect(ok).To(BeTrue(), ".Config.Volumes[/foo]")

r := podmanTest.Podman([]string{"run", "newimage"})
r.WaitWithDefaultTimeout()
Expand All @@ -250,7 +250,7 @@ var _ = Describe("Podman commit", func() {
for _, v := range image[0].Config.Env {
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() {
Expand Down
22 changes: 10 additions & 12 deletions test/e2e/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var _ = Describe("Podman create", func() {
check.WaitWithDefaultTimeout()
data := check.InspectContainerToJSON()
value, ok := data[0].Config.Annotations["HELLO"]
Expect(ok).To(BeTrue())
Expect(ok).To(BeTrue(), ".Config.Annotations[HELLO]")
Expect(value).To(Equal("WORLD"))
})

Expand Down Expand Up @@ -202,7 +202,7 @@ var _ = Describe("Podman create", func() {
Expect(session).Should(Exit(0))
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()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"start", "test_shared"})
Expand All @@ -211,10 +211,8 @@ var _ = Describe("Podman create", func() {
session = podmanTest.Podman([]string{"logs", "test_shared"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
found, matches := session.GrepString("/create/test")
Expect(found).Should(BeTrue())
Expect(matches[0]).To(ContainSubstring("rw"))
Expect(matches[0]).To(ContainSubstring("shared"))
Expect(session.OutputToString()).To(ContainSubstring("rw"))
Expect(session.OutputToString()).To(ContainSubstring("shared"))

mountPath = filepath.Join(podmanTest.TempDir, "scratchpad")
os.Mkdir(mountPath, 0755)
Expand Down Expand Up @@ -263,7 +261,7 @@ var _ = Describe("Podman create", func() {
session = podmanTest.Podman([]string{"pod", "inspect", podName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
podData := session.InspectPodToJSON()

// Finally we can create a container with --pod-id-file and do
Expand Down Expand Up @@ -386,12 +384,12 @@ var _ = Describe("Podman create", func() {
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
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))
_, ok1 := data[0].Config.Labels["TESTKEY1"]
Expect(ok1).To(BeTrue())
Expect(ok1).To(BeTrue(), ".Config.Labels[TESTKEY1]")
_, ok2 := data[0].Config.Labels["TESTKEY2"]
Expect(ok2).To(BeTrue())
Expect(ok2).To(BeTrue(), ".Config.Labels[TESTKEY2]")
})

It("podman create with set label", func() {
Expand All @@ -407,10 +405,10 @@ var _ = Describe("Podman create", func() {
Expect(len(data)).To(Equal(1))
Expect(len(data[0].Config.Labels)).To(Equal(2))
val1, ok1 := data[0].Config.Labels["TESTKEY1"]
Expect(ok1).To(BeTrue())
Expect(ok1).To(BeTrue(), ".Config.Labels[TESTKEY1]")
Expect(val1).To(Equal("value1"))
val2, ok2 := data[0].Config.Labels["TESTKEY2"]
Expect(ok2).To(BeTrue())
Expect(ok2).To(BeTrue(), ".Config.Labels[TESTKEY2]")
Expect(val2).To(Equal("bar"))
})

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var _ = Describe("Podman diff", func() {
session := podmanTest.Podman([]string{"diff", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
})

It("podman diff container and committed image", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/generate_kube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ var _ = Describe("Podman generate kube", func() {
err = yaml.Unmarshal(b, pod)
Expect(err).To(BeNil())
val, found := pod.Annotations[define.BindMountPrefix+vol1]
Expect(found).To(BeTrue())
Expect(found).To(BeTrue(), "pod.Annotations["+vol1+"]")
Expect(val).To(HaveSuffix("z"))

rm := podmanTest.Podman([]string{"pod", "rm", "-t", "0", "-f", "test1"})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/generate_systemd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ var _ = Describe("Podman generate systemd", func() {
session := podmanTest.Podman([]string{"generate", "systemd", "--format", "json", "foo"})
session.WaitWithDefaultTimeout()
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() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ var _ = Describe("Podman history", func() {
session := podmanTest.Podman([]string{"history", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
})
})
2 changes: 1 addition & 1 deletion test/e2e/image_sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ var _ = Describe("Podman image sign", func() {
Expect(session).Should(Exit(0))
fInfos, err := ioutil.ReadDir(filepath.Join(sigDir, "library"))
Expect(err).To(BeNil())
Expect(len(fInfos) > 1).To(BeTrue())
Expect(len(fInfos)).To(BeNumerically(">", 1), "len(fInfos)")
})
})
8 changes: 4 additions & 4 deletions test/e2e/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ var _ = Describe("Podman images", func() {
session := podmanTest.Podman([]string{"images", "--format=json", "not-existing-image"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
})

It("podman images in JSON format", func() {
session := podmanTest.Podman([]string{"images", "--format=json"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
})

It("podman images in GO template format", func() {
Expand Down Expand Up @@ -254,7 +254,7 @@ WORKDIR /test
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
imageData := session.InspectImageJSON()

result := podmanTest.Podman([]string{"images", "sha256:" + imageData[0].ID})
Expand All @@ -266,7 +266,7 @@ WORKDIR /test
session := podmanTest.Podman([]string{"image", "inspect", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
imageData := session.InspectImageJSON()

result := podmanTest.Podman([]string{"image", "ls", fmt.Sprintf("sha256:%s", imageData[0].ID)})
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var _ = Describe("Podman inspect", func() {
session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
imageData := session.InspectImageJSON()
Expect(imageData[0].RepoTags[0]).To(Equal("quay.io/libpod/alpine:latest"))
})
Expand Down Expand Up @@ -314,7 +314,7 @@ var _ = Describe("Podman inspect", func() {
inspect := podmanTest.Podman([]string{"inspect", podName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
Expect(podData[0].Name).To(Equal(podName))
})
Expand All @@ -328,7 +328,7 @@ var _ = Describe("Podman inspect", func() {
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
Expect(podData[0].Name).To(Equal(podName))
})
Expand All @@ -343,7 +343,7 @@ var _ = Describe("Podman inspect", func() {
inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", "--latest"})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
Expect(inspect.OutputToString()).To(BeValidJSON())
podData := inspect.InspectPodArrToJSON()
Expect(podData[0].Name).To(Equal(podName))
})
Expand All @@ -357,14 +357,14 @@ var _ = Describe("Podman inspect", func() {
inspect1 := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
inspect1.WaitWithDefaultTimeout()
Expect(inspect1).Should(Exit(0))
Expect(inspect1.IsJSONOutputValid()).To(BeTrue())
Expect(inspect1.OutputToString()).To(BeValidJSON())
podData := inspect1.InspectPodArrToJSON()
infra := podData[0].Containers[0].Name

inspect := podmanTest.Podman([]string{"inspect", "--latest"})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect.IsJSONOutputValid()).To(BeTrue())
Expect(inspect.OutputToString()).To(BeValidJSON())
containerData := inspect.InspectContainerToJSON()
Expect(containerData[0].Name).To(Equal(infra))
})
Expand All @@ -388,7 +388,7 @@ var _ = Describe("Podman inspect", func() {
session = podmanTest.Podman([]string{"inspect", volName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
})

It("podman inspect a volume with --format", func() {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ var _ = Describe("Podman load", func() {

result := podmanTest.Podman([]string{"images", "hello:world"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.OutputToString()).To(Not(ContainSubstring("docker")))
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
})

Expand All @@ -246,7 +246,7 @@ var _ = Describe("Podman load", func() {

result := podmanTest.Podman([]string{"images", "hello:latest"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.OutputToString()).To(Not(ContainSubstring("docker")))
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
})

Expand All @@ -272,7 +272,7 @@ var _ = Describe("Podman load", func() {

result := podmanTest.Podman([]string{"images", "load:latest"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.OutputToString()).To(Not(ContainSubstring("docker")))
Expect(result.OutputToString()).To(ContainSubstring("localhost"))
})

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var _ = Describe("Podman mount", func() {
j := podmanTest.Podman([]string{"mount", "--format=json"})
j.WaitWithDefaultTimeout()
Expect(j).Should(Exit(0))
Expect(j.IsJSONOutputValid()).To(BeTrue())
Expect(j.OutputToString()).To(BeValidJSON())

j = podmanTest.Podman([]string{"mount", "--format='{{.foobar}}'"})
j.WaitWithDefaultTimeout()
Expand Down Expand Up @@ -332,7 +332,7 @@ var _ = Describe("Podman mount", func() {
j := podmanTest.Podman([]string{"image", "mount", "--format=json"})
j.WaitWithDefaultTimeout()
Expect(j).Should(Exit(0))
Expect(j.IsJSONOutputValid()).To(BeTrue())
Expect(j.OutputToString()).To(BeValidJSON())

umount := podmanTest.Podman([]string{"image", "umount", fedoraMinimal})
umount.WaitWithDefaultTimeout()
Expand Down
9 changes: 4 additions & 5 deletions test/e2e/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"os"
"strings"
"time"

"github.com/containers/podman/v3/libpod/network/types"
Expand Down Expand Up @@ -234,7 +233,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman(append([]string{"network", "inspect"}, expectedNetworks...))
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.IsJSONOutputValid()).To(BeTrue())
Expect(session.OutputToString()).To(BeValidJSON())
})

It("podman network inspect", func() {
Expand Down Expand Up @@ -269,7 +268,7 @@ var _ = Describe("Podman network", func() {
Expect(ok).To(BeTrue())
Expect(net.NetworkID).To(Equal(netName))
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
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
Expand Down Expand Up @@ -342,12 +341,12 @@ var _ = Describe("Podman network", func() {
Expect(ok).To(BeTrue())
Expect(net1.NetworkID).To(Equal(netName1))
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]
Expect(ok).To(BeTrue())
Expect(net2.NetworkID).To(Equal(netName2))
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
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
Expand Down
Loading

0 comments on commit 295a6f7

Please sign in to comment.