chore: 统一本地服务器与远程仓库源码
- 合并 main 与 master 历史并以服务器结构为基线 - 保留迁移、数据保留、AWS 账单与部署安全能力 - 建立 SDD 规格和 CI 验证闭环
This commit is contained in:
commit
fd60361d93
460 files changed
+37492
-23871
No files matched your search
@@ -1,15 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
AIOps Integration Tests
|
||||
python3 tests/integration_test.py [--host HOST] [--port PORT]
|
||||
python3 tests/integration_test.py [--host HOST] [--port PORT] [--username USERNAME] [--password PASSWORD]
|
||||
"""
|
||||
import urllib.request, urllib.error, json, sys, time, argparse
|
||||
import urllib.request, urllib.error, json, os, sys, time, argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--host", default="localhost")
|
||||
parser.add_argument("--port", default="80")
|
||||
parser.add_argument("--username", default=os.getenv("AIOPS_TEST_USERNAME"))
|
||||
parser.add_argument("--password", default=os.getenv("AIOPS_TEST_PASSWORD"))
|
||||
args = parser.parse_args()
|
||||
|
||||
# 集成测试必须显式提供测试账号,避免误用默认凭证访问非 CI 环境。 # Logan.Li
|
||||
if not args.username or not args.password:
|
||||
parser.error("请通过 --username/--password 或 AIOPS_TEST_USERNAME/AIOPS_TEST_PASSWORD 提供测试账号")
|
||||
|
||||
BASE = "http://{}:{}".format(args.host, args.port)
|
||||
TOKEN = ""
|
||||
PASSED = 0
|
||||
@@ -57,12 +63,10 @@ check("Version API ", s)
|
||||
# [2] Login
|
||||
print("\n[2] Authentication")
|
||||
s, d = api("POST", "/api/v1/auth/login",
|
||||
body={"username": "admin", "password": "123456"}, auth=False)
|
||||
body={"username": args.username, "password": args.password}, auth=False)
|
||||
if check("Login ", s):
|
||||
TOKEN = d.get("data", {}).get("token", "")
|
||||
if TOKEN:
|
||||
print(" [INFO] Token: " + TOKEN[:40] + "...")
|
||||
else:
|
||||
if not TOKEN:
|
||||
print(" [WARN] No token in response")
|
||||
FAILED += 1
|
||||
|
||||
|
||||
Reference in new issue
Block a user