summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-07-14 12:39:24 -0500
committerBrent Baude <bbaude@redhat.com>2020-07-15 07:06:58 -0500
commitc58127602e57ad489bd951760026dccd7593eeaf (patch)
treef6498628033dfaa81e173bd2eec1869e3b1773fe /test/system
parent60127cf5e88ef53748cb601d7c27f082d284e7f4 (diff)
downloadpodman-c58127602e57ad489bd951760026dccd7593eeaf.tar.gz
podman-c58127602e57ad489bd951760026dccd7593eeaf.tar.bz2
podman-c58127602e57ad489bd951760026dccd7593eeaf.zip
Error on rootless mac and ip addresses
When creating a pod or container where a static MAC or IP address is provided, we should return a proper error and exit as 125. Fixes: #6972 Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r--test/system/200-pod.bats8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 0e9d9132e..0ad555305 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -165,9 +165,13 @@ function random_ip() {
# Create a pod with all the desired options
# FIXME: --ip=$ip fails:
# Error adding network: failed to allocate all requested IPs
+ local mac_option="--mac-address=$mac"
+ if is_rootless; then
+ mac_option=
+ fi
run_podman pod create --name=mypod \
--pod-id-file=$pod_id_file \
- --mac-address=$mac \
+ $mac_option \
--hostname=$hostname \
--add-host "$add_host_n:$add_host_ip" \
--dns "$dns_server" \
@@ -181,7 +185,7 @@ function random_ip() {
is "$(<$pod_id_file)" "$pod_id" "contents of pod-id-file"
# Check each of the options
- if ! is_rootless; then
+ if [ -n "$mac_option" ]; then
run_podman run --rm --pod mypod $IMAGE ip link show
# 'ip' outputs hex in lower-case, ${expr,,} converts UC to lc
is "$output" ".* link/ether ${mac,,} " "requested MAC address was set"