aboutsummaryrefslogtreecommitdiff
path: root/test/system/200-pod.bats
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-07-14 12:39:24 -0500
committerMatthew Heon <matthew.heon@pm.me>2020-07-22 14:13:43 -0400
commitc6852ee516abe3e1c4e5e31168d85d7cd446ce36 (patch)
treec99dba6af62b3c767b9a0f9a8d18201fad3e5445 /test/system/200-pod.bats
parentc31dc9b26054104c749cf7551f92b888a24c2586 (diff)
downloadpodman-c6852ee516abe3e1c4e5e31168d85d7cd446ce36.tar.gz
podman-c6852ee516abe3e1c4e5e31168d85d7cd446ce36.tar.bz2
podman-c6852ee516abe3e1c4e5e31168d85d7cd446ce36.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> <MH: Fixed build after cherry-pick> Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'test/system/200-pod.bats')
-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 9a6b39057..478ff06bb 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -153,9 +153,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" \
@@ -168,7 +172,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"