Path: blob/master/hack/test-nonplain-static-port-forward.sh
2611 views
#!/usr/bin/env bash12# SPDX-FileCopyrightText: Copyright The Lima Authors3# SPDX-License-Identifier: Apache-2.045set -euxo pipefail67INSTANCE=nonplain-static-port-forward8TEMPLATE="$(dirname "$0")/test-templates/test-misc.yaml"910limactl delete -f "$INSTANCE" || true1112limactl start --name="$INSTANCE" --tty=false "$TEMPLATE"1314limactl shell "$INSTANCE" -- bash -c 'until systemctl is-active --quiet nginx; do sleep 1; done'15limactl shell "$INSTANCE" -- bash -c 'until systemctl is-active --quiet test-server-9080; do sleep 1; done'16limactl shell "$INSTANCE" -- bash -c 'until systemctl is-active --quiet test-server-9070; do sleep 1; done'1718curl -sSf http://127.0.0.1:9090 | grep -i 'nginx' && echo 'Static port forwarding (9090) works in normal mode!'19curl -sSf http://127.0.0.1:29080 | grep -i 'Dynamic port 9080' && echo 'Dynamic port forwarding (29080) works in normal mode!'20curl -sSf http://127.0.0.1:29070 | grep -i 'Dynamic port 9070' && echo 'Dynamic port forwarding (29070) works in normal mode!'2122limactl delete -f "$INSTANCE"23echo "All tests passed for normal mode - both static and dynamic ports work!"24# EOF252627