跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

test-plain-static-port-forward.sh

39 行 · 1.1 KB历史下载
1#!/usr/bin/env bash
2
3# SPDX-FileCopyrightText: Copyright The Lima Authors
4# SPDX-License-Identifier: Apache-2.0
5
6set -euxo pipefail
7
8INSTANCE=plain-static-port-forward
9TEMPLATE="$(dirname "$0")/test-templates/test-misc.yaml"
10
11limactl delete -f "$INSTANCE" || true
12
13limactl start --name="$INSTANCE" --plain=true --tty=false "$TEMPLATE"
14
15limactl shell "$INSTANCE" -- bash -c 'until systemctl is-active --quiet nginx; do sleep 1; done'
16
17if ! curl -sSf http://127.0.0.1:9090 | grep -i 'nginx'; then
18 echo 'ERROR: Static port forwarding (9090) does not work in plain mode!'
19 exit 1
20fi
21echo 'Static port forwarding (9090) works in plain mode!'
22
23if curl -sSf http://127.0.0.1:29080 2>/dev/null; then
24 echo 'ERROR: Dynamic port 29080 should not be forwarded in plain mode!'
25 exit 1
26else
27 echo 'Dynamic port 29080 is correctly NOT forwarded in plain mode.'
28fi
29
30if curl -sSf http://127.0.0.1:29070 2>/dev/null; then
31 echo 'ERROR: Dynamic port 29070 should not be forwarded in plain mode!'
32 exit 1
33else
34 echo 'Dynamic port 29070 is correctly NOT forwarded in plain mode.'
35fi
36
37limactl delete -f "$INSTANCE"
38echo "All tests passed for plain mode - only static ports work!"
39# EOF