Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/hack/test-nonplain-static-port-forward.sh
2611 views
1
#!/usr/bin/env bash
2
3
# SPDX-FileCopyrightText: Copyright The Lima Authors
4
# SPDX-License-Identifier: Apache-2.0
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
# EOF
26
27