summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorBaron Lenardson <lenardson.baron@gmail.com>2021-01-27 21:13:23 -0600
committerBaron Lenardson <lenardson.baron@gmail.com>2021-05-17 08:21:22 -0500
commitc8dfcce6db0adfa2f91d979271e8c2725eb753a6 (patch)
treec509303139c828583537ce415d11c1edae5d7ad6 /test/system
parentd8dc56ba6758e590d14fca0c733246454837faf9 (diff)
downloadpodman-c8dfcce6db0adfa2f91d979271e8c2725eb753a6.tar.gz
podman-c8dfcce6db0adfa2f91d979271e8c2725eb753a6.tar.bz2
podman-c8dfcce6db0adfa2f91d979271e8c2725eb753a6.zip
Add host.containers.internal entry into container's etc/hosts
This change adds the entry `host.containers.internal` to the `/etc/hosts` file within a new containers filesystem. The ip address is determined by the containers networking configuration and points to the gateway address for the containers networking namespace. Closes #5651 Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
Diffstat (limited to 'test/system')
-rw-r--r--test/system/500-networking.bats21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index 34220829a..654bd5d8a 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -162,6 +162,27 @@ load helpers
done
}
+@test "podman run with slirp4ns assigns correct gateway address to host.containers.internal" {
+ CIDR="$(random_rfc1918_subnet)"
+ run_podman run --network slirp4netns:cidr="${CIDR}.0/24" \
+ $IMAGE grep 'host.containers.internal' /etc/hosts
+ is "$output" "${CIDR}.2 host.containers.internal" "host.containers.internal should be the cidr+2 address"
+}
+
+@test "podman run with slirp4ns adds correct dns address to resolv.conf" {
+ CIDR="$(random_rfc1918_subnet)"
+ run_podman run --network slirp4netns:cidr="${CIDR}.0/24" \
+ $IMAGE grep "${CIDR}" /etc/resolv.conf
+ is "$output" "nameserver ${CIDR}.3" "resolv.conf should have slirp4netns cidr+3 as a nameserver"
+}
+
+@test "podman run with slirp4ns assigns correct ip address container" {
+ CIDR="$(random_rfc1918_subnet)"
+ run_podman run --network slirp4netns:cidr="${CIDR}.0/24" \
+ $IMAGE sh -c "ip address | grep ${CIDR}"
+ is "$output" ".*inet ${CIDR}.100/24 \+" "container should have slirp4netns cidr+100 assigned to interface"
+}
+
# "network create" now works rootless, with the help of a special container
@test "podman network create" {
myport=54322