summaryrefslogtreecommitdiffstats
path: root/test/units/TEST-13-NSPAWN.nspawn.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest/units/TEST-13-NSPAWN.nspawn.sh60
1 files changed, 53 insertions, 7 deletions
diff --git a/test/units/TEST-13-NSPAWN.nspawn.sh b/test/units/TEST-13-NSPAWN.nspawn.sh
index ee0fef8..ad11468 100755
--- a/test/units/TEST-13-NSPAWN.nspawn.sh
+++ b/test/units/TEST-13-NSPAWN.nspawn.sh
@@ -943,6 +943,17 @@ matrix_run_one() {
return 0
}
+testcase_api_vfs() {
+ local api_vfs_writable
+
+ for api_vfs_writable in yes no network; do
+ matrix_run_one no no $api_vfs_writable
+ matrix_run_one yes no $api_vfs_writable
+ matrix_run_one no yes $api_vfs_writable
+ matrix_run_one yes yes $api_vfs_writable
+ done
+}
+
testcase_check_os_release() {
# https://github.com/systemd/systemd/issues/29185
local base common_opts root
@@ -973,11 +984,46 @@ testcase_check_os_release() {
rm -fr "$root" "$base"
}
-run_testcases
+testcase_ip_masquerade() {
+ local root
+
+ if ! command -v networkctl >/dev/null; then
+ echo "This test requires systemd-networkd, skipping..."
+ return 0
+ fi
+
+ systemctl unmask systemd-networkd.service
+ systemctl edit --runtime --stdin systemd-networkd.service --drop-in=debug.conf <<EOF
+[Service]
+Environment=SYSTEMD_LOG_LEVEL=debug
+EOF
+ systemctl start systemd-networkd.service
-for api_vfs_writable in yes no network; do
- matrix_run_one no no $api_vfs_writable
- matrix_run_one yes no $api_vfs_writable
- matrix_run_one no yes $api_vfs_writable
- matrix_run_one yes yes $api_vfs_writable
-done
+ root="$(mktemp -d /var/lib/machines/TEST-13-NSPAWN.ip_masquerade.XXX)"
+ create_dummy_container "$root"
+
+ systemd-run --unit=nspawn-hoge.service \
+ systemd-nspawn \
+ --register=no \
+ --directory="$root" \
+ --ephemeral \
+ --machine=hoge \
+ --network-veth \
+ bash -x -c "ip link set host0 up; sleep 30s"
+
+ /usr/lib/systemd/systemd-networkd-wait-online -i ve-hoge --timeout 30s
+
+ # Check IPMasquerade= for ve-* and friends enabled IP forwarding.
+ [[ "$(cat /proc/sys/net/ipv4/conf/all/forwarding)" == "1" ]]
+ [[ "$(cat /proc/sys/net/ipv4/conf/default/forwarding)" == "1" ]]
+ [[ "$(cat /proc/sys/net/ipv6/conf/all/forwarding)" == "1" ]]
+ [[ "$(cat /proc/sys/net/ipv6/conf/default/forwarding)" == "1" ]]
+
+ systemctl stop nspawn-hoge.service || :
+ systemctl stop systemd-networkd.service
+ systemctl mask systemd-networkd.service
+
+ rm -fr "$root"
+}
+
+run_testcases