fix(deploy): 修复组件版本解析和安装升级验收流程
Test deployment public URL (Linux) / test-linux (push) Waiting to run
Test start.ps1 (Windows) / test-windows (push) Waiting to run

This commit is contained in:
2026-10-18 00:18:00 +08:00
parent 895d92317e
commit b99eb849b4
30 changed files with 1579 additions and 270 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""Run the installer's actual proxy verification with deterministic HTTP transports."""
import os
from pathlib import Path
import subprocess
import tempfile
source = Path(__file__).resolve().parent.parent
with tempfile.TemporaryDirectory(prefix='easyai-proxy-entry-') as temporary:
root = Path(temporary)
script = (source / 'start.sh').read_text().rsplit('main "$@"', 1)[0]
(root / 'functions.sh').write_text(script)
curl = root / 'curl'
curl.write_text('''#!/usr/bin/env python3
import json,os,sys
with open(os.environ['CURL_CALLS'],'a') as out:out.write(json.dumps(sys.argv[1:])+'\\n')
if os.environ['HTTP_CASE']=='home-error':sys.exit(22)
if any('/api/health/update-ready' in arg for arg in sys.argv):
print(json.dumps({'status':'ok','service':'wrong-upstream' if os.environ['HTTP_CASE']=='wrong-upstream' else 'easyai-server-main'}))
''')
curl.chmod(0o755)
for name, mode, succeeds in [('home-error', 'ip', False), ('wrong-upstream', 'domain', False), ('healthy', 'ip', True), ('healthy', 'https', True)]:
log = root / 'curl.jsonl'
log.write_text('')
env = {**os.environ, 'PATH': str(root) + os.pathsep + os.environ['PATH'], 'HTTP_CASE': name, 'CURL_CALLS': str(log)}
run = '. ./functions.sh; DEPLOY_MODE="$1"; DEPLOY_IP=192.0.2.10; DEPLOY_DOMAIN=deployment.example; DEPLOY_HTTPS=false; if [ "$1" = https ]; then DEPLOY_MODE=domain; DEPLOY_HTTPS=true; fi; verify_proxy_entry'
result = subprocess.run(['bash', '-c', run, 'fixture', mode], cwd=root, env=env, capture_output=True, text=True, timeout=15)
assert (result.returncode == 0) == succeeds, (name, mode, result.stdout, result.stderr)
calls = log.read_text()
if mode == 'ip':
assert 'Host: 192.0.2.10' in calls
if mode == 'https':
assert '--resolve' in calls and 'deployment.example:443:127.0.0.1' in calls
assert '--insecure' not in calls and '"-k"' not in calls
print(name + '/' + mode + ': passed')