Merge pull request #20022 from edsantiago/e2e_check_stderr__more

more ExitCleanly()
This commit is contained in:
OpenShift Merge Robot
2023-09-19 09:37:24 +02:00
committed by GitHub
2 changed files with 135 additions and 132 deletions

View File

@ -24,12 +24,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.12.0/24", "--ip-range", "10.11.12.0/26", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -51,7 +51,7 @@ var _ = Describe("Podman network create", func() {
try := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"})
try.WaitWithDefaultTimeout()
Expect(try).To(Exit(0))
Expect(try).To(ExitCleanly())
_, subnet, err := net.ParseCIDR("10.11.12.0/24")
Expect(err).ToNot(HaveOccurred())
@ -76,12 +76,12 @@ var _ = Describe("Podman network create", func() {
})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -117,12 +117,12 @@ var _ = Describe("Podman network create", func() {
})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -160,12 +160,12 @@ var _ = Describe("Podman network create", func() {
})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -205,12 +205,12 @@ var _ = Describe("Podman network create", func() {
})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -246,12 +246,12 @@ var _ = Describe("Podman network create", func() {
})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -276,12 +276,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:1:2:3:4::/64", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -300,7 +300,7 @@ var _ = Describe("Podman network create", func() {
try := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | grep global | awk ' /inet6 / {print $2}'"})
try.WaitWithDefaultTimeout()
Expect(try).To(Exit(0))
Expect(try).To(ExitCleanly())
_, subnet, err := net.ParseCIDR("fd00:1:2:3:4::/64")
Expect(err).ToNot(HaveOccurred())
@ -315,12 +315,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:3:2::/64", "--ipv6", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -348,12 +348,12 @@ var _ = Describe("Podman network create", func() {
nc = podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:10:3:2::/64", "--ipv6", netName2})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName2)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect = podmanTest.Podman([]string{"network", "inspect", netName2})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
err = json.Unmarshal([]byte(inspect.OutputToString()), &results)
@ -401,12 +401,12 @@ var _ = Describe("Podman network create", func() {
name := stringid.GenerateRandomID()
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.14.0/24", "--ipv6", name})
nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
defer podmanTest.removeNetwork(name)
nc = podmanTest.Podman([]string{"network", "inspect", name})
nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`::/64`))
Expect(nc.OutputToString()).To(ContainSubstring(`10.11.14.0/24`))
})
@ -415,12 +415,12 @@ var _ = Describe("Podman network create", func() {
name := stringid.GenerateRandomID()
nc := podmanTest.Podman([]string{"network", "create", "--ipv6", name})
nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
defer podmanTest.removeNetwork(name)
nc = podmanTest.Podman([]string{"network", "inspect", name})
nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`::/64`))
Expect(nc.OutputToString()).To(ContainSubstring(`.0/24`))
})
@ -442,7 +442,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
ncFail := podmanTest.Podman([]string{"network", "create", netName})
ncFail.WaitWithDefaultTimeout()
@ -454,7 +454,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", netName1})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
netName2 := "sub2-" + stringid.GenerateRandomID()
ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", netName2})
@ -468,7 +468,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", netName1})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
netName2 := "subipv62-" + stringid.GenerateRandomID()
ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", netName2})
@ -488,11 +488,11 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--opt", "mtu=9000", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`"mtu": "9000"`))
})
@ -501,11 +501,11 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--opt", "vlan=9", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`"vlan": "9"`))
})
@ -523,6 +523,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--internal", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
// Cannot ExitCleanly(): "dnsname and internal networks are incompatible"
Expect(nc).Should(Exit(0))
// Not performing this check on remote tests because it is a logrus error which does
// not come back via stderr on the remote client.
@ -531,7 +532,7 @@ var _ = Describe("Podman network create", func() {
}
nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
Expect(nc.OutputToString()).ToNot(ContainSubstring("dnsname"))
})
@ -541,7 +542,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--internal", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Not performing this check on remote tests because it is a logrus error which does
// not come back via stderr on the remote client.
if !IsRemote() {
@ -549,7 +550,7 @@ var _ = Describe("Podman network create", func() {
}
nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`"dns_enabled": true`))
})
@ -569,12 +570,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--subnet", subnet2, name})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name))
inspect := podmanTest.Podman([]string{"network", "inspect", name})
inspect.WaitWithDefaultTimeout()
Expect(inspect).To(Exit(0))
Expect(inspect).To(ExitCleanly())
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2))
Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": false`))
@ -587,12 +588,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--subnet", subnet2, name})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name))
inspect := podmanTest.Podman([]string{"network", "inspect", name})
inspect.WaitWithDefaultTimeout()
Expect(inspect).To(Exit(0))
Expect(inspect).To(ExitCleanly())
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2))
Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": true`))
@ -608,12 +609,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--gateway", gw1, "--ip-range", range1, "--subnet", subnet2, "--gateway", gw2, name})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name))
inspect := podmanTest.Podman([]string{"network", "inspect", name})
inspect.WaitWithDefaultTimeout()
Expect(inspect).To(Exit(0))
Expect(inspect).To(ExitCleanly())
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
Expect(inspect.OutputToString()).To(ContainSubstring(`"gateway": "` + gw1))
Expect(inspect.OutputToString()).To(ContainSubstring(`"start_ip": "10.10.3.1",`))
@ -647,7 +648,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman(networkCreateCommand)
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name))
nc = podmanTest.Podman(networkCreateCommand)
@ -661,12 +662,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman(networkCreateCommand)
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name))
nc = podmanTest.Podman(networkCreateCommand)
nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name))
})
@ -676,17 +677,17 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--interface-name", bridgeName, netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).To(Exit(0))
Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(netName))
session := podmanTest.Podman([]string{"network", "inspect", "--format", "{{.NetworkInterface}}", netName})
session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0))
Expect(session).To(ExitCleanly())
Expect(session.OutputToString()).To(Equal(bridgeName))
session = podmanTest.Podman([]string{"run", "-d", "--network", netName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0))
Expect(session).To(ExitCleanly())
// can only check this as root
if !isRootless() {
@ -702,12 +703,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.16.0/24", "--ip-range", "10.11.16.11-10.11.16.12", netName})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
// Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -725,7 +726,7 @@ var _ = Describe("Podman network create", func() {
try := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"})
try.WaitWithDefaultTimeout()
Expect(try).To(Exit(0))
Expect(try).To(ExitCleanly())
containerIP, _, err := net.ParseCIDR(try.OutputToString())
Expect(err).ToNot(HaveOccurred())

View File

@ -21,7 +21,7 @@ var _ = Describe("Podman network", func() {
netDir := filepath.Join(podmanTest.TempDir, "networks123")
session := podmanTest.Podman([]string{"--cni-config-dir", netDir, "network", "ls", "--noheading"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
// default network always exists
Expect(session.OutputToStringArray()).To(HaveLen(1))
})
@ -32,7 +32,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name))
})
@ -42,7 +42,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name))
})
@ -52,6 +52,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "driver=bridge"})
session.WaitWithDefaultTimeout()
// Cannot ExitCleanly(): "stat ~/.config/.../*.conflist: ENOENT"
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(name))
})
@ -62,7 +63,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "driver=bridge", "--filter", "name=" + name})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name))
})
@ -75,7 +76,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "name=" + name1, "--filter", "name=" + name2})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name1))
Expect(session.OutputToString()).To(ContainSubstring(name2))
})
@ -87,23 +88,23 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", "--label", label1, net1})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net1)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
net2 := "labelnet" + stringid.GenerateRandomID()
session = podmanTest.Podman([]string{"network", "create", "--label", label1, "--label", label2, net2})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net2)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(net1))
Expect(session.OutputToString()).To(ContainSubstring(net2))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1, "--filter", "label=" + label2})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).ToNot(ContainSubstring(net1))
Expect(session.OutputToString()).To(ContainSubstring(net2))
})
@ -113,7 +114,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "ls", "--filter", "namr=ab"})
session.WaitWithDefaultTimeout()
@ -127,7 +128,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "label=abc"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(Not(ContainSubstring(name)))
})
@ -137,12 +138,12 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=true"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=false"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).NotTo(ContainSubstring(name))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=foo"})
@ -158,35 +159,35 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
if podmanTest.NetworkBackend == Netavark {
// netavark uses a different algo for determining the id and it is not repeatable
getid := podmanTest.Podman([]string{"network", "inspect", net, "--format", "{{.ID}}"})
getid.WaitWithDefaultTimeout()
Expect(getid).Should(Exit(0))
Expect(getid).Should(ExitCleanly())
netID = getid.OutputToString()
}
// Tests Default Table Output
session = podmanTest.Podman([]string{"network", "ls", "--filter", "id=" + netID})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
expectedTable := "NETWORK ID NAME DRIVER"
Expect(session.OutputToString()).To(ContainSubstring(expectedTable))
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID[:12]))
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID[:50], "--no-trunc"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID))
session = podmanTest.Podman([]string{"network", "inspect", netID[:40]})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(net))
session = podmanTest.Podman([]string{"network", "inspect", netID[1:]})
@ -196,7 +197,7 @@ var _ = Describe("Podman network", func() {
session = podmanTest.Podman([]string{"network", "rm", netID})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
})
rmFunc := func(rm string) {
@ -213,16 +214,16 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name))
rm := podmanTest.Podman([]string{"network", rm, name})
rm.WaitWithDefaultTimeout()
Expect(rm).Should(Exit(0))
Expect(rm).Should(ExitCleanly())
results := podmanTest.Podman([]string{"network", "ls", "--quiet"})
results.WaitWithDefaultTimeout()
Expect(results).Should(Exit(0))
Expect(results).Should(ExitCleanly())
Expect(results.OutputToString()).To(Not(ContainSubstring(name)))
})
}
@ -247,7 +248,7 @@ var _ = Describe("Podman network", func() {
}
session := podmanTest.Podman(append([]string{"network", "inspect"}, expectedNetworks...))
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(BeValidJSON())
})
@ -257,7 +258,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "inspect", name, "--format", "{{.Driver}}"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring("bridge"))
})
@ -266,16 +267,16 @@ var _ = Describe("Podman network", func() {
network := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.50.0/24", netName})
network.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(network).Should(Exit(0))
Expect(network).Should(ExitCleanly())
ctrName := "testCtr"
container := podmanTest.Podman([]string{"run", "-dt", "--network", netName, "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout()
Expect(container).Should(Exit(0))
Expect(container).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
conData := inspect.InspectContainerToJSON()
Expect(conData).To(HaveLen(1))
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(1))
@ -288,7 +289,7 @@ var _ = Describe("Podman network", func() {
// Necessary to ensure the CNI network is removed cleanly
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
rmAll.WaitWithDefaultTimeout()
Expect(rmAll).Should(Exit(0))
Expect(rmAll).Should(ExitCleanly())
})
It("podman inspect container two CNI networks (container not running)", func() {
@ -296,22 +297,22 @@ var _ = Describe("Podman network", func() {
network1 := podmanTest.Podman([]string{"network", "create", netName1})
network1.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1)
Expect(network1).Should(Exit(0))
Expect(network1).Should(ExitCleanly())
netName2 := "net2-" + stringid.GenerateRandomID()
network2 := podmanTest.Podman([]string{"network", "create", netName2})
network2.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName2)
Expect(network2).Should(Exit(0))
Expect(network2).Should(ExitCleanly())
ctrName := "testCtr"
container := podmanTest.Podman([]string{"create", "--network", fmt.Sprintf("%s,%s", netName1, netName2), "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout()
Expect(container).Should(Exit(0))
Expect(container).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
conData := inspect.InspectContainerToJSON()
Expect(conData).To(HaveLen(1))
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
@ -325,7 +326,7 @@ var _ = Describe("Podman network", func() {
// Necessary to ensure the CNI network is removed cleanly
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
rmAll.WaitWithDefaultTimeout()
Expect(rmAll).Should(Exit(0))
Expect(rmAll).Should(ExitCleanly())
})
It("podman inspect container two CNI networks", func() {
@ -333,22 +334,22 @@ var _ = Describe("Podman network", func() {
network1 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.0/25", netName1})
network1.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1)
Expect(network1).Should(Exit(0))
Expect(network1).Should(ExitCleanly())
netName2 := "net2-" + stringid.GenerateRandomID()
network2 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.128/26", netName2})
network2.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName2)
Expect(network2).Should(Exit(0))
Expect(network2).Should(ExitCleanly())
ctrName := "testCtr"
container := podmanTest.Podman([]string{"run", "-dt", "--network", fmt.Sprintf("%s,%s", netName1, netName2), "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout()
Expect(container).Should(Exit(0))
Expect(container).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
conData := inspect.InspectContainerToJSON()
Expect(conData).To(HaveLen(1))
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
@ -366,7 +367,7 @@ var _ = Describe("Podman network", func() {
// Necessary to ensure the CNI network is removed cleanly
rmAll := podmanTest.Podman([]string{"rm", "-t", "0", "-f", ctrName})
rmAll.WaitWithDefaultTimeout()
Expect(rmAll).Should(Exit(0))
Expect(rmAll).Should(ExitCleanly())
})
It("podman network remove after disconnect when container initially created with the network", func() {
@ -376,19 +377,19 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", network})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(network)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"run", "--name", container, "--network", network, "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "disconnect", network, container})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "rm", network})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
})
It("podman network remove bogus", func() {
@ -402,16 +403,16 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"pod", "create", "--network", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
podID := session.OutputToString()
session = podmanTest.Podman([]string{"create", "--pod", podID, ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "rm", netName})
session.WaitWithDefaultTimeout()
@ -419,7 +420,7 @@ var _ = Describe("Podman network", func() {
session = podmanTest.Podman([]string{"network", "rm", "-t", "0", "--force", netName})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
// check if pod is deleted
session = podmanTest.Podman([]string{"pod", "exists", podID})
@ -429,7 +430,7 @@ var _ = Describe("Podman network", func() {
// check if net is deleted
session = podmanTest.Podman([]string{"network", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(Not(ContainSubstring(netName)))
})
@ -438,17 +439,17 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName1})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
netName2 := "net2-" + stringid.GenerateRandomID()
session = podmanTest.Podman([]string{"network", "create", netName2})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName2)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "rm", netName1, netName2})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
lines := session.OutputToStringArray()
Expect(lines[0]).To(Equal(netName1))
Expect(lines[1]).To(Equal(netName2))
@ -460,7 +461,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
interval := 250 * time.Millisecond
for i := 0; i < 6; i++ {
@ -476,7 +477,7 @@ var _ = Describe("Podman network", func() {
top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", NGINX_IMAGE})
top.WaitWithDefaultTimeout()
Expect(top).Should(Exit(0))
Expect(top).Should(ExitCleanly())
interval = 250 * time.Millisecond
// Wait for the nginx service to be running
for i := 0; i < 6; i++ {
@ -494,14 +495,14 @@ var _ = Describe("Podman network", func() {
// Nginx is now running so no need to do a loop
// Test against the first alias
c2 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, NGINX_IMAGE, "curl", "web1"})
c2 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, NGINX_IMAGE, "curl", "-s", "web1"})
c2.WaitWithDefaultTimeout()
Expect(c2).Should(Exit(0))
Expect(c2).Should(ExitCleanly())
// Test against the second alias
c3 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, NGINX_IMAGE, "curl", "web2"})
c3 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, NGINX_IMAGE, "curl", "-s", "web2"})
c3.WaitWithDefaultTimeout()
Expect(c3).Should(Exit(0))
Expect(c3).Should(ExitCleanly())
})
It("podman network create/remove macvlan", func() {
@ -511,11 +512,12 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "--macvlan", "lo", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
// Cannot ExitCleanly(): "The --macvlan option is deprecated..."
Expect(nc).Should(Exit(0))
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
})
It("podman network create/remove macvlan as driver (-d) no device name", func() {
@ -525,11 +527,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable
var results []types.Network
@ -542,7 +544,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
})
for _, opt := range []string{"-o=parent=lo", "--interface-name=lo"} {
@ -554,11 +556,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", opt, net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
var results []types.Network
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
@ -573,7 +575,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
})
}
@ -584,11 +586,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "ipvlan", "-o", "parent=lo", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
var results []types.Network
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
@ -603,7 +605,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
})
It("podman network exists", func() {
@ -611,11 +613,11 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "exists", net})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "exists", stringid.GenerateRandomID()})
session.WaitWithDefaultTimeout()
@ -627,11 +629,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", "-o", "mtu=1500", "--gateway", "192.168.1.254", "--subnet", "192.168.1.0/24", net})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect).Should(ExitCleanly())
var results []types.Network
err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
@ -650,7 +652,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
})
It("podman network prune --filter", func() {
@ -660,11 +662,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", net1})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net1)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
list.WaitWithDefaultTimeout()
Expect(list).Should(Exit(0))
Expect(list).Should(ExitCleanly())
Expect(list.OutputToStringArray()).Should(HaveLen(2))
Expect(list.OutputToStringArray()).Should(ContainElement(net1))
@ -673,11 +675,11 @@ var _ = Describe("Podman network", func() {
// -f needed only to skip y/n question
prune := podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=50"})
prune.WaitWithDefaultTimeout()
Expect(prune).Should(Exit(0))
Expect(prune).Should(ExitCleanly())
listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0))
Expect(listAgain).Should(ExitCleanly())
Expect(listAgain.OutputToStringArray()).Should(HaveLen(2))
Expect(listAgain.OutputToStringArray()).Should(ContainElement(net1))
@ -686,11 +688,11 @@ var _ = Describe("Podman network", func() {
// -f needed only to skip y/n question
prune = podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=5000000000000"})
prune.WaitWithDefaultTimeout()
Expect(prune).Should(Exit(0))
Expect(prune).Should(ExitCleanly())
listAgain = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0))
Expect(listAgain).Should(ExitCleanly())
Expect(listAgain.OutputToStringArray()).Should(HaveLen(1))
Expect(listAgain.OutputToStringArray()).ShouldNot(ContainElement(net1))
@ -710,12 +712,12 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", net1})
nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net1)
Expect(nc).Should(Exit(0))
Expect(nc).Should(ExitCleanly())
nc2 := podmanTest.Podman([]string{"network", "create", net2})
nc2.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net2)
Expect(nc2).Should(Exit(0))
Expect(nc2).Should(ExitCleanly())
list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
list.WaitWithDefaultTimeout()
@ -727,15 +729,15 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--net", net2, ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session).Should(ExitCleanly())
prune := podmanTest.Podman([]string{"network", "prune", "-f"})
prune.WaitWithDefaultTimeout()
Expect(prune).Should(Exit(0))
Expect(prune).Should(ExitCleanly())
listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0))
Expect(listAgain).Should(ExitCleanly())
Expect(listAgain.OutputToStringArray()).Should(HaveLen(2))
Expect(listAgain.OutputToStringArray()).ShouldNot(ContainElement(net1))