mirror of
https://github.com/containers/podman.git
synced 2026-07-13 08:41:44 -04:00
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 <acui@redhat.com>
This commit is contained in:
@@ -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.
|
- `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.
|
- `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`.
|
manually by creating a custom route using `--route`.
|
||||||
|
|
||||||
Additionally the `bridge` driver supports the following options:
|
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
|
Create a network with a static subnet and a static route without a default
|
||||||
route.
|
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.
|
Create a Macvlan based network using the host interface eth0. Macvlan networks can only be used as root.
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ var _ = Describe("Podman network create", func() {
|
|||||||
defer removeNetworkDevice(result.NetworkInterface)
|
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()
|
netName := "subnet-" + stringid.GenerateRandomID()
|
||||||
nc := podmanTest.Podman([]string{
|
nc := podmanTest.Podman([]string{
|
||||||
"network",
|
"network",
|
||||||
@@ -198,7 +198,7 @@ var _ = Describe("Podman network create", func() {
|
|||||||
"--subnet",
|
"--subnet",
|
||||||
"10.19.15.0/24",
|
"10.19.15.0/24",
|
||||||
"--opt",
|
"--opt",
|
||||||
"no_default_route=1",
|
"no_default_route=true",
|
||||||
netName,
|
netName,
|
||||||
})
|
})
|
||||||
nc.WaitWithDefaultTimeout()
|
nc.WaitWithDefaultTimeout()
|
||||||
@@ -405,7 +405,7 @@ var _ = Describe("Podman network create", func() {
|
|||||||
|
|
||||||
ncFail := podmanTest.Podman([]string{"network", "create", netName})
|
ncFail := podmanTest.Podman([]string{"network", "create", netName})
|
||||||
ncFail.WaitWithDefaultTimeout()
|
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() {
|
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 := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", netName2})
|
||||||
ncFail.WaitWithDefaultTimeout()
|
ncFail.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(netName2)
|
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() {
|
It("podman network create with invalid network name", func() {
|
||||||
nc := podmanTest.Podman([]string{"network", "create", "2bad!"})
|
nc := podmanTest.Podman([]string{"network", "create", "2bad!"})
|
||||||
nc.WaitWithDefaultTimeout()
|
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() {
|
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 := podmanTest.Podman([]string{"network", "create", "--opt", "foo=bar", net})
|
||||||
nc.WaitWithDefaultTimeout()
|
nc.WaitWithDefaultTimeout()
|
||||||
defer podmanTest.removeNetwork(net)
|
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() {
|
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 = podmanTest.Podman(networkCreateCommand)
|
||||||
nc.WaitWithDefaultTimeout()
|
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() {
|
It("podman network create same name - succeed with ignore", func() {
|
||||||
|
|||||||
@@ -1114,7 +1114,7 @@ options ndots:1
|
|||||||
nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet, "--subnet", subnet, netName})
|
nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet, "--subnet", subnet, netName})
|
||||||
nc.WaitWithDefaultTimeout()
|
nc.WaitWithDefaultTimeout()
|
||||||
Expect(nc).ShouldNot(ExitCleanly())
|
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() {
|
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 := podmanTest.Podman([]string{"network", "create", "--subnet", subnet, "--subnet", subnet, netName})
|
||||||
nc.WaitWithDefaultTimeout()
|
nc.WaitWithDefaultTimeout()
|
||||||
Expect(nc).ShouldNot(ExitCleanly())
|
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() {
|
It("podman network create with overlapping subnets", func() {
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ function run_pod_etc_hosts_test(){
|
|||||||
|
|
||||||
# Cannot create network with the same name
|
# Cannot create network with the same name
|
||||||
run_podman 125 network create $mynetname
|
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"
|
"Trying to create an already-existing network"
|
||||||
|
|
||||||
run_podman rm -t 0 -f $cid
|
run_podman rm -t 0 -f $cid
|
||||||
|
|||||||
Reference in New Issue
Block a user