From bb02e490809e1a5587665ac38af3fbbca81410df Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Thu, 23 Apr 2026 15:36:14 -0400 Subject: [PATCH] Adjust error messages for new netavark create c/common uses the new netavark create command, so some of the error messages have slightly changed. Adjust the tests so they pass. Signed-off-by: Ashley Cui --- docs/source/markdown/podman-network-create.1.md | 4 ++-- test/e2e/network_create_test.go | 14 +++++++------- test/e2e/run_networking_test.go | 4 ++-- test/system/500-networking.bats | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/source/markdown/podman-network-create.1.md b/docs/source/markdown/podman-network-create.1.md index 18b64c4ed8..d7731da066 100644 --- a/docs/source/markdown/podman-network-create.1.md +++ b/docs/source/markdown/podman-network-create.1.md @@ -115,7 +115,7 @@ All drivers accept the `mtu`, `metric`, `no_default_route` and options. - `mtu`: Sets the Maximum Transmission Unit (MTU) and takes an integer value. - `metric` Sets the Route Metric for the default route created in every container joined to this network. Accepts a positive integer value. Can only be used with the Netavark network backend. -- `no_default_route`: If set to 1, Podman will not automatically add a default route to subnets. Routes can still be added +- `no_default_route`: If set to true, Podman will not automatically add a default route to subnets. Routes can still be added manually by creating a custom route using `--route`. Additionally the `bridge` driver supports the following options: @@ -196,7 +196,7 @@ $ podman network create --subnet 192.168.33.0/24 --route 10.1.0.0/24,192.168.33. Create a network with a static subnet and a static route without a default route. ``` -$ podman network create --subnet 192.168.33.0/24 --route 10.1.0.0/24,192.168.33.10 --opt no_default_route=1 newnet +$ podman network create --subnet 192.168.33.0/24 --route 10.1.0.0/24,192.168.33.10 --opt no_default_route=true newnet ``` Create a Macvlan based network using the host interface eth0. Macvlan networks can only be used as root. diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go index 5714fa733d..0872244836 100644 --- a/test/e2e/network_create_test.go +++ b/test/e2e/network_create_test.go @@ -190,7 +190,7 @@ var _ = Describe("Podman network create", func() { defer removeNetworkDevice(result.NetworkInterface) }) - It("podman network create with name and subnet with --opt no_default_route=1", func() { + It("podman network create with name and subnet with --opt no_default_route=true", func() { netName := "subnet-" + stringid.GenerateRandomID() nc := podmanTest.Podman([]string{ "network", @@ -198,7 +198,7 @@ var _ = Describe("Podman network create", func() { "--subnet", "10.19.15.0/24", "--opt", - "no_default_route=1", + "no_default_route=true", netName, }) nc.WaitWithDefaultTimeout() @@ -405,7 +405,7 @@ var _ = Describe("Podman network create", func() { ncFail := podmanTest.Podman([]string{"network", "create", netName}) ncFail.WaitWithDefaultTimeout() - Expect(ncFail).To(ExitWithError(125, fmt.Sprintf("network name %s already used: network already exists", netName))) + Expect(ncFail).To(ExitWithError(125, "network already exists")) }) It("podman network create two networks with same subnet should fail", func() { @@ -433,13 +433,13 @@ var _ = Describe("Podman network create", func() { ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", netName2}) ncFail.WaitWithDefaultTimeout() defer podmanTest.removeNetwork(netName2) - Expect(ncFail).To(ExitWithError(125, "subnet fd00:4:4:4::/64 is already used on the host or by another config")) + Expect(ncFail).To(ExitWithError(125, "subnet fd00:4:4:4:4::/64 is already used on the host or by another config")) }) It("podman network create with invalid network name", func() { nc := podmanTest.Podman([]string{"network", "create", "2bad!"}) nc.WaitWithDefaultTimeout() - Expect(nc).To(ExitWithError(125, "network name 2bad! invalid: names must match [a-zA-Z0-9][a-zA-Z0-9_.-]*: invalid argument")) + Expect(nc).To(ExitWithError(125, "Invalid characters in network name \"2bad!\": must match [a-zA-Z0-9][a-zA-Z0-9_.-]*")) }) It("podman network create with mtu option", func() { @@ -471,7 +471,7 @@ var _ = Describe("Podman network create", func() { nc := podmanTest.Podman([]string{"network", "create", "--opt", "foo=bar", net}) nc.WaitWithDefaultTimeout() defer podmanTest.removeNetwork(net) - Expect(nc).To(ExitWithError(125, "unsupported bridge network option foo")) + Expect(nc).To(ExitWithError(125, "unsupported bridge network option: foo")) }) It("podman Netavark network create with internal should have dnsname", func() { @@ -586,7 +586,7 @@ var _ = Describe("Podman network create", func() { nc = podmanTest.Podman(networkCreateCommand) nc.WaitWithDefaultTimeout() - Expect(nc).To(ExitWithError(125, fmt.Sprintf("network name %s already used: network already exists", name))) + Expect(nc).To(ExitWithError(125, fmt.Sprintf("network already exists %s", name))) }) It("podman network create same name - succeed with ignore", func() { diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 34d44bcbb6..7ef3d9ef35 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -1114,7 +1114,7 @@ options ndots:1 nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet, "--subnet", subnet, netName}) nc.WaitWithDefaultTimeout() Expect(nc).ShouldNot(ExitCleanly()) - Expect(nc.ErrorToString()).To(ContainSubstring("duplicate subnets")) + Expect(nc.ErrorToString()).To(ContainSubstring("duplicate subnet")) }) It("podman network create with same IPv6 subnets", func() { @@ -1124,7 +1124,7 @@ options ndots:1 nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet, "--subnet", subnet, netName}) nc.WaitWithDefaultTimeout() Expect(nc).ShouldNot(ExitCleanly()) - Expect(nc.ErrorToString()).To(ContainSubstring("duplicate subnets")) + Expect(nc.ErrorToString()).To(ContainSubstring("duplicate subnet")) }) It("podman network create with overlapping subnets", func() { diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats index 43cbd268f7..e3cbd23682 100644 --- a/test/system/500-networking.bats +++ b/test/system/500-networking.bats @@ -292,7 +292,7 @@ function run_pod_etc_hosts_test(){ # Cannot create network with the same name run_podman 125 network create $mynetname - is "$output" "Error: network name $mynetname already used: network already exists" \ + is "$output" "Error: netavark: network already exists $mynetname" \ "Trying to create an already-existing network" run_podman rm -t 0 -f $cid