| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | set -euxo pipefail |
| 7 | |
| 8 | INSTANCE=nonplain-static-port-forward |
| 9 | TEMPLATE="$(dirname "$0")/test-templates/test-misc.yaml" |
| 10 | |
| 11 | limactl delete -f "$INSTANCE" || true |
| 12 | |
| 13 | limactl start --name="$INSTANCE" --tty=false "$TEMPLATE" |
| 14 | |
| 15 | limactl shell "$INSTANCE" -- bash -c 'until systemctl is-active --quiet nginx; do sleep 1; done' |
| 16 | limactl shell "$INSTANCE" -- bash -c 'until systemctl is-active --quiet test-server-9080; do sleep 1; done' |
| 17 | limactl shell "$INSTANCE" -- bash -c 'until systemctl is-active --quiet test-server-9070; do sleep 1; done' |
| 18 | |
| 19 | curl -sSf http://127.0.0.1:9090 | grep -i 'nginx' && echo 'Static port forwarding (9090) works in normal mode!' |
| 20 | curl -sSf http://127.0.0.1:29080 | grep -i 'Dynamic port 9080' && echo 'Dynamic port forwarding (29080) works in normal mode!' |
| 21 | curl -sSf http://127.0.0.1:29070 | grep -i 'Dynamic port 9070' && echo 'Dynamic port forwarding (29070) works in normal mode!' |
| 22 | |
| 23 | limactl delete -f "$INSTANCE" |
| 24 | echo "All tests passed for normal mode - both static and dynamic ports work!" |
| 25 | |