feat: 新增 Plan B 整目录重装脚本,不影响 setup_env 一键安装
添加 deploy/reinstall.sh 备份 env、克隆、调 setup_env、恢复配置并 PM2 启动; 附带 pm2_start_all.sh 与 hub_settings 清理工具。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""deploy/sanitize_hub_settings.py 单元测试。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
REPO = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(REPO / "deploy"))
|
||||
|
||||
from sanitize_hub_settings import sanitize_settings # noqa: E402
|
||||
|
||||
|
||||
def test_drops_gate_bot_and_keeps_gate():
|
||||
raw = {
|
||||
"exchanges": [
|
||||
{"id": "0", "key": "binance", "name": "币安", "agent_url": "http://127.0.0.1:15200"},
|
||||
{"id": "3", "key": "gate_bot", "name": "Gate bot", "agent_url": "http://127.0.0.1:15203"},
|
||||
{"id": "2", "key": "gate", "name": "Gate", "flask_url": "http://127.0.0.1:5000"},
|
||||
]
|
||||
}
|
||||
cleaned, removed = sanitize_settings(raw)
|
||||
keys = [x["key"] for x in cleaned["exchanges"]]
|
||||
assert keys == ["binance", "gate"]
|
||||
assert len(removed) == 1
|
||||
|
||||
|
||||
def test_drops_port_5002_legacy():
|
||||
raw = {
|
||||
"exchanges": [
|
||||
{
|
||||
"id": "3",
|
||||
"key": "legacy",
|
||||
"name": "crypto_monitor_gate_bot",
|
||||
"flask_url": "http://127.0.0.1:5002",
|
||||
},
|
||||
]
|
||||
}
|
||||
cleaned, removed = sanitize_settings(raw)
|
||||
assert cleaned["exchanges"] == []
|
||||
assert removed
|
||||
Reference in New Issue
Block a user