slirp4netns can be used without options

Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
This commit is contained in:
Bas Zoetekouw 2024-03-21 19:41:25 +01:00 committed by Povilas Kanapickas
parent 9fd4cf43c1
commit 6feff244db
2 changed files with 2 additions and 1 deletions

View File

@ -787,7 +787,7 @@ def get_net_args(compose, cnt):
is_bridge = False
elif net == "host":
net_args.append(f"--network={net}")
elif net.startswith("slirp4netns:"):
elif net.startswith("slirp4netns"): # Note: podman-specific network mode
net_args.append(f"--network={net}")
elif net.startswith("ns:"):
net_args.append(f"--network={net}")

View File

@ -259,6 +259,7 @@ class TestGetNetArgs(unittest.TestCase):
("bridge", ["--network=bridge", f"--network-alias={SERVICE_NAME}"]),
("host", ["--network=host"]),
("none", []),
("slirp4netns", ["--network=slirp4netns"]),
("slirp4netns:cidr=10.42.0.0/24", ["--network=slirp4netns:cidr=10.42.0.0/24"]),
("pasta:--ipv4-only,-a,10.0.2.0", ["--network=pasta:--ipv4-only,-a,10.0.2.0"]),
("container:my_container", ["--network=container:my_container"]),