summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrecipes-containers/vcontainer/files/vcontainer-common.sh10
-rw-r--r--tests/test_vdkr.py8
2 files changed, 13 insertions, 5 deletions
diff --git a/recipes-containers/vcontainer/files/vcontainer-common.sh b/recipes-containers/vcontainer/files/vcontainer-common.sh
index 9003e0c7..b0623164 100755
--- a/recipes-containers/vcontainer/files/vcontainer-common.sh
+++ b/recipes-containers/vcontainer/files/vcontainer-common.sh
@@ -1333,7 +1333,15 @@ case "$COMMAND" in
1333 PS_EXIT=$? 1333 PS_EXIT=$?
1334 1334
1335 # Show host port forwards if daemon is running and we have any 1335 # Show host port forwards if daemon is running and we have any
1336 if daemon_is_running; then 1336 # Skip if -q/--quiet flag is present (only container IDs requested)
1337 PS_QUIET=false
1338 for arg in "${COMMAND_ARGS[@]}"; do
1339 case "$arg" in
1340 -q|--quiet) PS_QUIET=true; break ;;
1341 esac
1342 done
1343
1344 if [ "$PS_QUIET" = "false" ] && daemon_is_running; then
1337 pf_file=$(get_port_forward_file) 1345 pf_file=$(get_port_forward_file)
1338 if [ -f "$pf_file" ] && [ -s "$pf_file" ]; then 1346 if [ -f "$pf_file" ] && [ -s "$pf_file" ]; then
1339 echo "" 1347 echo ""
diff --git a/tests/test_vdkr.py b/tests/test_vdkr.py
index c343e05f..33744107 100644
--- a/tests/test_vdkr.py
+++ b/tests/test_vdkr.py
@@ -101,16 +101,16 @@ class TestPortForwarding:
101 # Stop any running memres first 101 # Stop any running memres first
102 vdkr.memres_stop() 102 vdkr.memres_stop()
103 103
104 # Start memres with port forwarding 104 # Start memres (no static port forwards needed - use dynamic via -p on run)
105 result = vdkr.memres_start(timeout=180, port_forwards=["8080:80"]) 105 result = vdkr.memres_start(timeout=180)
106 assert result.returncode == 0, f"memres start failed: {result.stderr}" 106 assert result.returncode == 0, f"memres start failed: {result.stderr}"
107 107
108 try: 108 try:
109 # Pull nginx:alpine if not present 109 # Pull nginx:alpine if not present
110 vdkr.run("pull", "nginx:alpine", timeout=300) 110 vdkr.run("pull", "nginx:alpine", timeout=300)
111 111
112 # Run nginx (--network=host is the default) 112 # Run nginx with port forward - Docker sets up iptables for bridge networking
113 result = vdkr.run("run", "-d", "--rm", "nginx:alpine", timeout=60) 113 result = vdkr.run("run", "-d", "--rm", "-p", "8080:80", "nginx:alpine", timeout=60)
114 assert result.returncode == 0, f"nginx run failed: {result.stderr}" 114 assert result.returncode == 0, f"nginx run failed: {result.stderr}"
115 115
116 # Give nginx time to start 116 # Give nginx time to start