e2e: continuing ExitCleanly() work

Commit 1 of 2: simple replace of Exit(0) with ExitCleanly()

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2023-09-14 13:40:24 -06:00
parent c5851976bb
commit d78221545c
2 changed files with 133 additions and 133 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 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.12.0/24", "--ip-range", "10.11.12.0/26", netName})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network 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 := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"})
try.WaitWithDefaultTimeout() try.WaitWithDefaultTimeout()
Expect(try).To(Exit(0)) Expect(try).To(ExitCleanly())
_, subnet, err := net.ParseCIDR("10.11.12.0/24") _, subnet, err := net.ParseCIDR("10.11.12.0/24")
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
@ -76,12 +76,12 @@ var _ = Describe("Podman network create", func() {
}) })
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network var results []types.Network
@ -117,12 +117,12 @@ var _ = Describe("Podman network create", func() {
}) })
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network var results []types.Network
@ -160,12 +160,12 @@ var _ = Describe("Podman network create", func() {
}) })
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network var results []types.Network
@ -205,12 +205,12 @@ var _ = Describe("Podman network create", func() {
}) })
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network var results []types.Network
@ -246,12 +246,12 @@ var _ = Describe("Podman network create", func() {
}) })
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network 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 := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:1:2:3:4::/64", netName})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network 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 := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | grep global | awk ' /inet6 / {print $2}'"})
try.WaitWithDefaultTimeout() try.WaitWithDefaultTimeout()
Expect(try).To(Exit(0)) Expect(try).To(ExitCleanly())
_, subnet, err := net.ParseCIDR("fd00:1:2:3:4::/64") _, subnet, err := net.ParseCIDR("fd00:1:2:3:4::/64")
Expect(err).ToNot(HaveOccurred()) 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 := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:3:2::/64", "--ipv6", netName})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network 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 = podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:10:3:2::/64", "--ipv6", netName2})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName2) defer podmanTest.removeNetwork(netName2)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect = podmanTest.Podman([]string{"network", "inspect", netName2}) inspect = podmanTest.Podman([]string{"network", "inspect", netName2})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
err = json.Unmarshal([]byte(inspect.OutputToString()), &results) err = json.Unmarshal([]byte(inspect.OutputToString()), &results)
@ -401,12 +401,12 @@ var _ = Describe("Podman network create", func() {
name := stringid.GenerateRandomID() name := stringid.GenerateRandomID()
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.14.0/24", "--ipv6", name}) nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.14.0/24", "--ipv6", name})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
defer podmanTest.removeNetwork(name) defer podmanTest.removeNetwork(name)
nc = podmanTest.Podman([]string{"network", "inspect", name}) nc = podmanTest.Podman([]string{"network", "inspect", name})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`::/64`)) Expect(nc.OutputToString()).To(ContainSubstring(`::/64`))
Expect(nc.OutputToString()).To(ContainSubstring(`10.11.14.0/24`)) Expect(nc.OutputToString()).To(ContainSubstring(`10.11.14.0/24`))
}) })
@ -415,12 +415,12 @@ var _ = Describe("Podman network create", func() {
name := stringid.GenerateRandomID() name := stringid.GenerateRandomID()
nc := podmanTest.Podman([]string{"network", "create", "--ipv6", name}) nc := podmanTest.Podman([]string{"network", "create", "--ipv6", name})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
defer podmanTest.removeNetwork(name) defer podmanTest.removeNetwork(name)
nc = podmanTest.Podman([]string{"network", "inspect", name}) nc = podmanTest.Podman([]string{"network", "inspect", name})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`::/64`)) Expect(nc.OutputToString()).To(ContainSubstring(`::/64`))
Expect(nc.OutputToString()).To(ContainSubstring(`.0/24`)) 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 := podmanTest.Podman([]string{"network", "create", netName})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
ncFail := podmanTest.Podman([]string{"network", "create", netName}) ncFail := podmanTest.Podman([]string{"network", "create", netName})
ncFail.WaitWithDefaultTimeout() 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 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", netName1})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1) defer podmanTest.removeNetwork(netName1)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
netName2 := "sub2-" + stringid.GenerateRandomID() netName2 := "sub2-" + stringid.GenerateRandomID()
ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", netName2}) 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 := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", netName1})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1) defer podmanTest.removeNetwork(netName1)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
netName2 := "subipv62-" + stringid.GenerateRandomID() netName2 := "subipv62-" + stringid.GenerateRandomID()
ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", netName2}) 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 := podmanTest.Podman([]string{"network", "create", "--opt", "mtu=9000", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
nc = podmanTest.Podman([]string{"network", "inspect", net}) nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`"mtu": "9000"`)) 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 := podmanTest.Podman([]string{"network", "create", "--opt", "vlan=9", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
nc = podmanTest.Podman([]string{"network", "inspect", net}) nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`"vlan": "9"`)) Expect(nc.OutputToString()).To(ContainSubstring(`"vlan": "9"`))
}) })
@ -523,7 +523,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--internal", net}) nc := podmanTest.Podman([]string{"network", "create", "--internal", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) 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 performing this check on remote tests because it is a logrus error which does
// not come back via stderr on the remote client. // not come back via stderr on the remote client.
if !IsRemote() { if !IsRemote() {
@ -531,7 +531,7 @@ var _ = Describe("Podman network create", func() {
} }
nc = podmanTest.Podman([]string{"network", "inspect", net}) nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
Expect(nc.OutputToString()).ToNot(ContainSubstring("dnsname")) Expect(nc.OutputToString()).ToNot(ContainSubstring("dnsname"))
}) })
@ -541,7 +541,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--internal", net}) nc := podmanTest.Podman([]string{"network", "create", "--internal", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) 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 performing this check on remote tests because it is a logrus error which does
// not come back via stderr on the remote client. // not come back via stderr on the remote client.
if !IsRemote() { if !IsRemote() {
@ -549,7 +549,7 @@ var _ = Describe("Podman network create", func() {
} }
nc = podmanTest.Podman([]string{"network", "inspect", net}) nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
Expect(nc.OutputToString()).To(ContainSubstring(`"dns_enabled": true`)) Expect(nc.OutputToString()).To(ContainSubstring(`"dns_enabled": true`))
}) })
@ -569,12 +569,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--subnet", subnet2, name}) nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--subnet", subnet2, name})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name) defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name)) Expect(nc.OutputToString()).To(Equal(name))
inspect := podmanTest.Podman([]string{"network", "inspect", name}) inspect := podmanTest.Podman([]string{"network", "inspect", name})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).To(Exit(0)) Expect(inspect).To(ExitCleanly())
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1)) Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2)) Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2))
Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": false`)) Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": false`))
@ -587,12 +587,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--subnet", subnet2, name}) nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--subnet", subnet2, name})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name) defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name)) Expect(nc.OutputToString()).To(Equal(name))
inspect := podmanTest.Podman([]string{"network", "inspect", name}) inspect := podmanTest.Podman([]string{"network", "inspect", name})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).To(Exit(0)) Expect(inspect).To(ExitCleanly())
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1)) Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2)) Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2))
Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": true`)) Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": true`))
@ -608,12 +608,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 := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--gateway", gw1, "--ip-range", range1, "--subnet", subnet2, "--gateway", gw2, name})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name) defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name)) Expect(nc.OutputToString()).To(Equal(name))
inspect := podmanTest.Podman([]string{"network", "inspect", name}) inspect := podmanTest.Podman([]string{"network", "inspect", name})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).To(Exit(0)) Expect(inspect).To(ExitCleanly())
Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1)) Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
Expect(inspect.OutputToString()).To(ContainSubstring(`"gateway": "` + gw1)) Expect(inspect.OutputToString()).To(ContainSubstring(`"gateway": "` + gw1))
Expect(inspect.OutputToString()).To(ContainSubstring(`"start_ip": "10.10.3.1",`)) Expect(inspect.OutputToString()).To(ContainSubstring(`"start_ip": "10.10.3.1",`))
@ -647,7 +647,7 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman(networkCreateCommand) nc := podmanTest.Podman(networkCreateCommand)
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name) defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name)) Expect(nc.OutputToString()).To(Equal(name))
nc = podmanTest.Podman(networkCreateCommand) nc = podmanTest.Podman(networkCreateCommand)
@ -661,12 +661,12 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman(networkCreateCommand) nc := podmanTest.Podman(networkCreateCommand)
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(name) defer podmanTest.removeNetwork(name)
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name)) Expect(nc.OutputToString()).To(Equal(name))
nc = podmanTest.Podman(networkCreateCommand) nc = podmanTest.Podman(networkCreateCommand)
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(name)) Expect(nc.OutputToString()).To(Equal(name))
}) })
@ -676,17 +676,17 @@ var _ = Describe("Podman network create", func() {
nc := podmanTest.Podman([]string{"network", "create", "--interface-name", bridgeName, netName}) nc := podmanTest.Podman([]string{"network", "create", "--interface-name", bridgeName, netName})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).To(Exit(0)) Expect(nc).To(ExitCleanly())
Expect(nc.OutputToString()).To(Equal(netName)) Expect(nc.OutputToString()).To(Equal(netName))
session := podmanTest.Podman([]string{"network", "inspect", "--format", "{{.NetworkInterface}}", netName}) session := podmanTest.Podman([]string{"network", "inspect", "--format", "{{.NetworkInterface}}", netName})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0)) Expect(session).To(ExitCleanly())
Expect(session.OutputToString()).To(Equal(bridgeName)) Expect(session.OutputToString()).To(Equal(bridgeName))
session = podmanTest.Podman([]string{"run", "-d", "--network", netName, ALPINE, "top"}) session = podmanTest.Podman([]string{"run", "-d", "--network", netName, ALPINE, "top"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0)) Expect(session).To(ExitCleanly())
// can only check this as root // can only check this as root
if !isRootless() { if !isRootless() {
@ -702,12 +702,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 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.16.0/24", "--ip-range", "10.11.16.11-10.11.16.12", netName})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
// Inspect the network configuration // Inspect the network configuration
inspect := podmanTest.Podman([]string{"network", "inspect", netName}) inspect := podmanTest.Podman([]string{"network", "inspect", netName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network var results []types.Network
@ -725,7 +725,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 := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"})
try.WaitWithDefaultTimeout() try.WaitWithDefaultTimeout()
Expect(try).To(Exit(0)) Expect(try).To(ExitCleanly())
containerIP, _, err := net.ParseCIDR(try.OutputToString()) containerIP, _, err := net.ParseCIDR(try.OutputToString())
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())

View File

@ -21,7 +21,7 @@ var _ = Describe("Podman network", func() {
netDir := filepath.Join(podmanTest.TempDir, "networks123") netDir := filepath.Join(podmanTest.TempDir, "networks123")
session := podmanTest.Podman([]string{"--cni-config-dir", netDir, "network", "ls", "--noheading"}) session := podmanTest.Podman([]string{"--cni-config-dir", netDir, "network", "ls", "--noheading"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
// default network always exists // default network always exists
Expect(session.OutputToStringArray()).To(HaveLen(1)) Expect(session.OutputToStringArray()).To(HaveLen(1))
}) })
@ -32,7 +32,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls"}) session := podmanTest.Podman([]string{"network", "ls"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name)) Expect(session.OutputToString()).To(ContainSubstring(name))
}) })
@ -42,7 +42,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--quiet"}) session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name)) Expect(session.OutputToString()).To(ContainSubstring(name))
}) })
@ -52,7 +52,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "driver=bridge"}) session := podmanTest.Podman([]string{"network", "ls", "--filter", "driver=bridge"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name)) Expect(session.OutputToString()).To(ContainSubstring(name))
}) })
@ -62,7 +62,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "driver=bridge", "--filter", "name=" + name}) session := podmanTest.Podman([]string{"network", "ls", "--filter", "driver=bridge", "--filter", "name=" + name})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name)) Expect(session.OutputToString()).To(ContainSubstring(name))
}) })
@ -75,7 +75,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "name=" + name1, "--filter", "name=" + name2}) session := podmanTest.Podman([]string{"network", "ls", "--filter", "name=" + name1, "--filter", "name=" + name2})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name1)) Expect(session.OutputToString()).To(ContainSubstring(name1))
Expect(session.OutputToString()).To(ContainSubstring(name2)) Expect(session.OutputToString()).To(ContainSubstring(name2))
}) })
@ -87,23 +87,23 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", "--label", label1, net1}) session := podmanTest.Podman([]string{"network", "create", "--label", label1, net1})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net1) defer podmanTest.removeNetwork(net1)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
net2 := "labelnet" + stringid.GenerateRandomID() net2 := "labelnet" + stringid.GenerateRandomID()
session = podmanTest.Podman([]string{"network", "create", "--label", label1, "--label", label2, net2}) session = podmanTest.Podman([]string{"network", "create", "--label", label1, "--label", label2, net2})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net2) defer podmanTest.removeNetwork(net2)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1}) session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(net1)) Expect(session.OutputToString()).To(ContainSubstring(net1))
Expect(session.OutputToString()).To(ContainSubstring(net2)) Expect(session.OutputToString()).To(ContainSubstring(net2))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1, "--filter", "label=" + label2}) session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1, "--filter", "label=" + label2})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).ToNot(ContainSubstring(net1)) Expect(session.OutputToString()).ToNot(ContainSubstring(net1))
Expect(session.OutputToString()).To(ContainSubstring(net2)) Expect(session.OutputToString()).To(ContainSubstring(net2))
}) })
@ -113,7 +113,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net}) session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "ls", "--filter", "namr=ab"}) session = podmanTest.Podman([]string{"network", "ls", "--filter", "namr=ab"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
@ -127,7 +127,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "label=abc"}) session := podmanTest.Podman([]string{"network", "ls", "--filter", "label=abc"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(Not(ContainSubstring(name))) Expect(session.OutputToString()).To(Not(ContainSubstring(name)))
}) })
@ -137,12 +137,12 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=true"}) session := podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=true"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name)) Expect(session.OutputToString()).To(ContainSubstring(name))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=false"}) session = podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=false"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).NotTo(ContainSubstring(name)) Expect(session.OutputToString()).NotTo(ContainSubstring(name))
session = podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=foo"}) session = podmanTest.Podman([]string{"network", "ls", "--filter", "dangling=foo"})
@ -158,35 +158,35 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net}) session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
if podmanTest.NetworkBackend == Netavark { if podmanTest.NetworkBackend == Netavark {
// netavark uses a different algo for determining the id and it is not repeatable // netavark uses a different algo for determining the id and it is not repeatable
getid := podmanTest.Podman([]string{"network", "inspect", net, "--format", "{{.ID}}"}) getid := podmanTest.Podman([]string{"network", "inspect", net, "--format", "{{.ID}}"})
getid.WaitWithDefaultTimeout() getid.WaitWithDefaultTimeout()
Expect(getid).Should(Exit(0)) Expect(getid).Should(ExitCleanly())
netID = getid.OutputToString() netID = getid.OutputToString()
} }
// Tests Default Table Output // Tests Default Table Output
session = podmanTest.Podman([]string{"network", "ls", "--filter", "id=" + netID}) session = podmanTest.Podman([]string{"network", "ls", "--filter", "id=" + netID})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
expectedTable := "NETWORK ID NAME DRIVER" expectedTable := "NETWORK ID NAME DRIVER"
Expect(session.OutputToString()).To(ContainSubstring(expectedTable)) Expect(session.OutputToString()).To(ContainSubstring(expectedTable))
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID}) session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID[:12])) Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID[:12]))
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID[:50], "--no-trunc"}) session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID[:50], "--no-trunc"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID)) Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID))
session = podmanTest.Podman([]string{"network", "inspect", netID[:40]}) session = podmanTest.Podman([]string{"network", "inspect", netID[:40]})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(net)) Expect(session.OutputToString()).To(ContainSubstring(net))
session = podmanTest.Podman([]string{"network", "inspect", netID[1:]}) session = podmanTest.Podman([]string{"network", "inspect", netID[1:]})
@ -196,7 +196,7 @@ var _ = Describe("Podman network", func() {
session = podmanTest.Podman([]string{"network", "rm", netID}) session = podmanTest.Podman([]string{"network", "rm", netID})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
}) })
rmFunc := func(rm string) { rmFunc := func(rm string) {
@ -213,16 +213,16 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "ls", "--quiet"}) session := podmanTest.Podman([]string{"network", "ls", "--quiet"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(name)) Expect(session.OutputToString()).To(ContainSubstring(name))
rm := podmanTest.Podman([]string{"network", rm, name}) rm := podmanTest.Podman([]string{"network", rm, name})
rm.WaitWithDefaultTimeout() rm.WaitWithDefaultTimeout()
Expect(rm).Should(Exit(0)) Expect(rm).Should(ExitCleanly())
results := podmanTest.Podman([]string{"network", "ls", "--quiet"}) results := podmanTest.Podman([]string{"network", "ls", "--quiet"})
results.WaitWithDefaultTimeout() results.WaitWithDefaultTimeout()
Expect(results).Should(Exit(0)) Expect(results).Should(ExitCleanly())
Expect(results.OutputToString()).To(Not(ContainSubstring(name))) Expect(results.OutputToString()).To(Not(ContainSubstring(name)))
}) })
} }
@ -247,7 +247,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(ExitCleanly())
Expect(session.OutputToString()).To(BeValidJSON()) Expect(session.OutputToString()).To(BeValidJSON())
}) })
@ -257,7 +257,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "inspect", name, "--format", "{{.Driver}}"}) session := podmanTest.Podman([]string{"network", "inspect", name, "--format", "{{.Driver}}"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring("bridge")) Expect(session.OutputToString()).To(ContainSubstring("bridge"))
}) })
@ -266,16 +266,16 @@ var _ = Describe("Podman network", func() {
network := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.50.0/24", netName}) network := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.50.0/24", netName})
network.WaitWithDefaultTimeout() network.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(network).Should(Exit(0)) Expect(network).Should(ExitCleanly())
ctrName := "testCtr" ctrName := "testCtr"
container := podmanTest.Podman([]string{"run", "-dt", "--network", netName, "--name", ctrName, ALPINE, "top"}) container := podmanTest.Podman([]string{"run", "-dt", "--network", netName, "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout() container.WaitWithDefaultTimeout()
Expect(container).Should(Exit(0)) Expect(container).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"inspect", ctrName}) inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
conData := inspect.InspectContainerToJSON() conData := inspect.InspectContainerToJSON()
Expect(conData).To(HaveLen(1)) Expect(conData).To(HaveLen(1))
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(1)) Expect(conData[0].NetworkSettings.Networks).To(HaveLen(1))
@ -288,7 +288,7 @@ var _ = Describe("Podman network", func() {
// 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})
rmAll.WaitWithDefaultTimeout() rmAll.WaitWithDefaultTimeout()
Expect(rmAll).Should(Exit(0)) Expect(rmAll).Should(ExitCleanly())
}) })
It("podman inspect container two CNI networks (container not running)", func() { It("podman inspect container two CNI networks (container not running)", func() {
@ -296,22 +296,22 @@ var _ = Describe("Podman network", func() {
network1 := podmanTest.Podman([]string{"network", "create", netName1}) network1 := podmanTest.Podman([]string{"network", "create", netName1})
network1.WaitWithDefaultTimeout() network1.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1) defer podmanTest.removeNetwork(netName1)
Expect(network1).Should(Exit(0)) Expect(network1).Should(ExitCleanly())
netName2 := "net2-" + stringid.GenerateRandomID() netName2 := "net2-" + stringid.GenerateRandomID()
network2 := podmanTest.Podman([]string{"network", "create", netName2}) network2 := podmanTest.Podman([]string{"network", "create", netName2})
network2.WaitWithDefaultTimeout() network2.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName2) defer podmanTest.removeNetwork(netName2)
Expect(network2).Should(Exit(0)) Expect(network2).Should(ExitCleanly())
ctrName := "testCtr" ctrName := "testCtr"
container := podmanTest.Podman([]string{"create", "--network", fmt.Sprintf("%s,%s", netName1, netName2), "--name", ctrName, ALPINE, "top"}) container := podmanTest.Podman([]string{"create", "--network", fmt.Sprintf("%s,%s", netName1, netName2), "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout() container.WaitWithDefaultTimeout()
Expect(container).Should(Exit(0)) Expect(container).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"inspect", ctrName}) inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
conData := inspect.InspectContainerToJSON() conData := inspect.InspectContainerToJSON()
Expect(conData).To(HaveLen(1)) Expect(conData).To(HaveLen(1))
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2)) Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
@ -325,7 +325,7 @@ var _ = Describe("Podman network", func() {
// 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})
rmAll.WaitWithDefaultTimeout() rmAll.WaitWithDefaultTimeout()
Expect(rmAll).Should(Exit(0)) Expect(rmAll).Should(ExitCleanly())
}) })
It("podman inspect container two CNI networks", func() { It("podman inspect container two CNI networks", func() {
@ -333,22 +333,22 @@ var _ = Describe("Podman network", func() {
network1 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.0/25", netName1}) network1 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.0/25", netName1})
network1.WaitWithDefaultTimeout() network1.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1) defer podmanTest.removeNetwork(netName1)
Expect(network1).Should(Exit(0)) Expect(network1).Should(ExitCleanly())
netName2 := "net2-" + stringid.GenerateRandomID() netName2 := "net2-" + stringid.GenerateRandomID()
network2 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.128/26", netName2}) network2 := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.51.128/26", netName2})
network2.WaitWithDefaultTimeout() network2.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName2) defer podmanTest.removeNetwork(netName2)
Expect(network2).Should(Exit(0)) Expect(network2).Should(ExitCleanly())
ctrName := "testCtr" ctrName := "testCtr"
container := podmanTest.Podman([]string{"run", "-dt", "--network", fmt.Sprintf("%s,%s", netName1, netName2), "--name", ctrName, ALPINE, "top"}) container := podmanTest.Podman([]string{"run", "-dt", "--network", fmt.Sprintf("%s,%s", netName1, netName2), "--name", ctrName, ALPINE, "top"})
container.WaitWithDefaultTimeout() container.WaitWithDefaultTimeout()
Expect(container).Should(Exit(0)) Expect(container).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"inspect", ctrName}) inspect := podmanTest.Podman([]string{"inspect", ctrName})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
conData := inspect.InspectContainerToJSON() conData := inspect.InspectContainerToJSON()
Expect(conData).To(HaveLen(1)) Expect(conData).To(HaveLen(1))
Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2)) Expect(conData[0].NetworkSettings.Networks).To(HaveLen(2))
@ -366,7 +366,7 @@ var _ = Describe("Podman network", func() {
// 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})
rmAll.WaitWithDefaultTimeout() 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() { It("podman network remove after disconnect when container initially created with the network", func() {
@ -376,19 +376,19 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", network}) session := podmanTest.Podman([]string{"network", "create", network})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(network) 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 = podmanTest.Podman([]string{"run", "--name", container, "--network", network, "-d", ALPINE, "top"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "disconnect", network, container}) session = podmanTest.Podman([]string{"network", "disconnect", network, container})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "rm", network}) session = podmanTest.Podman([]string{"network", "rm", network})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
}) })
It("podman network remove bogus", func() { It("podman network remove bogus", func() {
@ -402,16 +402,16 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName}) session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"pod", "create", "--network", netName}) session = podmanTest.Podman([]string{"pod", "create", "--network", netName})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
podID := session.OutputToString() podID := session.OutputToString()
session = podmanTest.Podman([]string{"create", "--pod", podID, ALPINE}) session = podmanTest.Podman([]string{"create", "--pod", podID, ALPINE})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "rm", netName}) session = podmanTest.Podman([]string{"network", "rm", netName})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
@ -419,7 +419,7 @@ var _ = Describe("Podman network", func() {
session = podmanTest.Podman([]string{"network", "rm", "-t", "0", "--force", netName}) session = podmanTest.Podman([]string{"network", "rm", "-t", "0", "--force", netName})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
// check if pod is deleted // check if pod is deleted
session = podmanTest.Podman([]string{"pod", "exists", podID}) session = podmanTest.Podman([]string{"pod", "exists", podID})
@ -429,7 +429,7 @@ var _ = Describe("Podman network", func() {
// check if net is deleted // check if net is deleted
session = podmanTest.Podman([]string{"network", "ls"}) session = podmanTest.Podman([]string{"network", "ls"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(Not(ContainSubstring(netName))) Expect(session.OutputToString()).To(Not(ContainSubstring(netName)))
}) })
@ -438,17 +438,17 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName1}) session := podmanTest.Podman([]string{"network", "create", netName1})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName1) defer podmanTest.removeNetwork(netName1)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
netName2 := "net2-" + stringid.GenerateRandomID() netName2 := "net2-" + stringid.GenerateRandomID()
session = podmanTest.Podman([]string{"network", "create", netName2}) session = podmanTest.Podman([]string{"network", "create", netName2})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName2) defer podmanTest.removeNetwork(netName2)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "rm", netName1, netName2}) session = podmanTest.Podman([]string{"network", "rm", netName1, netName2})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
lines := session.OutputToStringArray() lines := session.OutputToStringArray()
Expect(lines[0]).To(Equal(netName1)) Expect(lines[0]).To(Equal(netName1))
Expect(lines[1]).To(Equal(netName2)) Expect(lines[1]).To(Equal(netName2))
@ -460,7 +460,7 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", netName}) session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
interval := 250 * time.Millisecond interval := 250 * time.Millisecond
for i := 0; i < 6; i++ { for i := 0; i < 6; i++ {
@ -476,7 +476,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 := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", NGINX_IMAGE})
top.WaitWithDefaultTimeout() top.WaitWithDefaultTimeout()
Expect(top).Should(Exit(0)) Expect(top).Should(ExitCleanly())
interval = 250 * time.Millisecond interval = 250 * time.Millisecond
// Wait for the nginx service to be running // Wait for the nginx service to be running
for i := 0; i < 6; i++ { for i := 0; i < 6; i++ {
@ -496,12 +496,12 @@ var _ = Describe("Podman network", func() {
// Test against the first alias // 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", "web1"})
c2.WaitWithDefaultTimeout() c2.WaitWithDefaultTimeout()
Expect(c2).Should(Exit(0)) Expect(c2).Should(ExitCleanly())
// Test against the second alias // 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", "web2"})
c3.WaitWithDefaultTimeout() c3.WaitWithDefaultTimeout()
Expect(c3).Should(Exit(0)) Expect(c3).Should(ExitCleanly())
}) })
It("podman network create/remove macvlan", func() { It("podman network create/remove macvlan", func() {
@ -511,11 +511,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "--macvlan", "lo", net}) nc := podmanTest.Podman([]string{"network", "create", "--macvlan", "lo", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
nc = podmanTest.Podman([]string{"network", "rm", net}) nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
}) })
It("podman network create/remove macvlan as driver (-d) no device name", func() { It("podman network create/remove macvlan as driver (-d) no device name", func() {
@ -525,11 +525,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", net}) nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"network", "inspect", net}) inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
// JSON the network configuration into something usable // JSON the network configuration into something usable
var results []types.Network var results []types.Network
@ -542,7 +542,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net}) nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
}) })
for _, opt := range []string{"-o=parent=lo", "--interface-name=lo"} { for _, opt := range []string{"-o=parent=lo", "--interface-name=lo"} {
@ -554,11 +554,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", opt, net}) nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", opt, net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"network", "inspect", net}) inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
var results []types.Network var results []types.Network
err := json.Unmarshal([]byte(inspect.OutputToString()), &results) err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
@ -573,7 +573,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net}) nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
}) })
} }
@ -584,11 +584,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", "-d", "ipvlan", "-o", "parent=lo", net}) nc := podmanTest.Podman([]string{"network", "create", "-d", "ipvlan", "-o", "parent=lo", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"network", "inspect", net}) inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
var results []types.Network var results []types.Network
err := json.Unmarshal([]byte(inspect.OutputToString()), &results) err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
@ -603,7 +603,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net}) nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
}) })
It("podman network exists", func() { It("podman network exists", func() {
@ -611,11 +611,11 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"network", "create", net}) session := podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "exists", net}) session = podmanTest.Podman([]string{"network", "exists", net})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"network", "exists", stringid.GenerateRandomID()}) session = podmanTest.Podman([]string{"network", "exists", stringid.GenerateRandomID()})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
@ -627,11 +627,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 := 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() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net) defer podmanTest.removeNetwork(net)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
inspect := podmanTest.Podman([]string{"network", "inspect", net}) inspect := podmanTest.Podman([]string{"network", "inspect", net})
inspect.WaitWithDefaultTimeout() inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(ExitCleanly())
var results []types.Network var results []types.Network
err := json.Unmarshal([]byte(inspect.OutputToString()), &results) err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
@ -650,7 +650,7 @@ var _ = Describe("Podman network", func() {
nc = podmanTest.Podman([]string{"network", "rm", net}) nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
}) })
It("podman network prune --filter", func() { It("podman network prune --filter", func() {
@ -660,11 +660,11 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", net1}) nc := podmanTest.Podman([]string{"network", "create", net1})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net1) defer podmanTest.removeNetwork(net1)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"}) list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
list.WaitWithDefaultTimeout() list.WaitWithDefaultTimeout()
Expect(list).Should(Exit(0)) Expect(list).Should(ExitCleanly())
Expect(list.OutputToStringArray()).Should(HaveLen(2)) Expect(list.OutputToStringArray()).Should(HaveLen(2))
Expect(list.OutputToStringArray()).Should(ContainElement(net1)) Expect(list.OutputToStringArray()).Should(ContainElement(net1))
@ -673,11 +673,11 @@ var _ = Describe("Podman network", func() {
// -f needed only to skip y/n question // -f needed only to skip y/n question
prune := podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=50"}) prune := podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=50"})
prune.WaitWithDefaultTimeout() prune.WaitWithDefaultTimeout()
Expect(prune).Should(Exit(0)) Expect(prune).Should(ExitCleanly())
listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"}) listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout() listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0)) Expect(listAgain).Should(ExitCleanly())
Expect(listAgain.OutputToStringArray()).Should(HaveLen(2)) Expect(listAgain.OutputToStringArray()).Should(HaveLen(2))
Expect(listAgain.OutputToStringArray()).Should(ContainElement(net1)) Expect(listAgain.OutputToStringArray()).Should(ContainElement(net1))
@ -686,11 +686,11 @@ var _ = Describe("Podman network", func() {
// -f needed only to skip y/n question // -f needed only to skip y/n question
prune = podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=5000000000000"}) prune = podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=5000000000000"})
prune.WaitWithDefaultTimeout() prune.WaitWithDefaultTimeout()
Expect(prune).Should(Exit(0)) Expect(prune).Should(ExitCleanly())
listAgain = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"}) listAgain = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout() listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0)) Expect(listAgain).Should(ExitCleanly())
Expect(listAgain.OutputToStringArray()).Should(HaveLen(1)) Expect(listAgain.OutputToStringArray()).Should(HaveLen(1))
Expect(listAgain.OutputToStringArray()).ShouldNot(ContainElement(net1)) Expect(listAgain.OutputToStringArray()).ShouldNot(ContainElement(net1))
@ -710,12 +710,12 @@ var _ = Describe("Podman network", func() {
nc := podmanTest.Podman([]string{"network", "create", net1}) nc := podmanTest.Podman([]string{"network", "create", net1})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net1) defer podmanTest.removeNetwork(net1)
Expect(nc).Should(Exit(0)) Expect(nc).Should(ExitCleanly())
nc2 := podmanTest.Podman([]string{"network", "create", net2}) nc2 := podmanTest.Podman([]string{"network", "create", net2})
nc2.WaitWithDefaultTimeout() nc2.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork(net2) defer podmanTest.removeNetwork(net2)
Expect(nc2).Should(Exit(0)) Expect(nc2).Should(ExitCleanly())
list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"}) list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
list.WaitWithDefaultTimeout() list.WaitWithDefaultTimeout()
@ -727,15 +727,15 @@ var _ = Describe("Podman network", func() {
session := podmanTest.Podman([]string{"run", "-dt", "--net", net2, ALPINE, "top"}) session := podmanTest.Podman([]string{"run", "-dt", "--net", net2, ALPINE, "top"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(ExitCleanly())
prune := podmanTest.Podman([]string{"network", "prune", "-f"}) prune := podmanTest.Podman([]string{"network", "prune", "-f"})
prune.WaitWithDefaultTimeout() prune.WaitWithDefaultTimeout()
Expect(prune).Should(Exit(0)) Expect(prune).Should(ExitCleanly())
listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"}) listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout() listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0)) Expect(listAgain).Should(ExitCleanly())
Expect(listAgain.OutputToStringArray()).Should(HaveLen(2)) Expect(listAgain.OutputToStringArray()).Should(HaveLen(2))
Expect(listAgain.OutputToStringArray()).ShouldNot(ContainElement(net1)) Expect(listAgain.OutputToStringArray()).ShouldNot(ContainElement(net1))