mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 16:30:29 +08:00
feat(elevator): 对齐 V1 lib 的 Davinci/扫描/事件与部署配置
- davinci-manager-storage:FilePart 路径与基址按 V1 JAR(/portal/file、/part/*、GET /download) - 启动类:扫描 cn.cloudwalk.serial 与 cn.cloudwalk.cwos.client.resource,补 UUIDSerial 与 ApplicationService - deploy:v1/v2 application 中 cloudwalk.serial.enabled、Kafka 指向 192.168.3.12:9092;deploy/.gitignore 忽略日志 - cloudwalk-common-serial:补充 META-INF/spring.factories(Boot 自动配置) - 电梯:Session 配置、Davinci Bean、Feign 包、MQTT/Visitor/Zone Feign;部署脚本与 API parity 工具更新 - 文档与根脚本若干;未纳入大体积 jar/zip 与 v1 CFR 对比目录 Made-with: Cursor Former-commit-id: b76d142d13ebb5c0898de2d9d11bc583876829c2
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from parity.client import can_reach_both, default_headers
|
||||
from parity.client import can_reach_both, can_reach_one, default_headers
|
||||
|
||||
_DIR = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
config._parity_rows = [] # type: ignore[attr-defined]
|
||||
config._smoke_rows = [] # type: ignore[attr-defined]
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
@@ -24,6 +26,14 @@ def pytest_addoption(parser):
|
||||
"--base-new",
|
||||
default=os.environ.get("ELEVATOR_BASE_NEW", "http://127.0.0.1:18081"),
|
||||
)
|
||||
parser.addoption(
|
||||
"--smoke-base",
|
||||
default=os.environ.get("ELEVATOR_SMOKE_BASE", "http://127.0.0.1:18080"),
|
||||
)
|
||||
parser.addoption(
|
||||
"--smoke-label",
|
||||
default=os.environ.get("ELEVATOR_SMOKE_LABEL", "v1_legacy"),
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
@@ -36,6 +46,16 @@ def base_new(request):
|
||||
return str(request.config.getoption("--base-new")).rstrip("/")
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def smoke_base(request):
|
||||
return str(request.config.getoption("--smoke-base")).rstrip("/")
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def smoke_label(request):
|
||||
return str(request.config.getoption("--smoke-label"))
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def session_http():
|
||||
s = requests.Session()
|
||||
@@ -55,27 +75,56 @@ def two_instances_ready(base_old, base_new, session_http, request):
|
||||
return True
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def smoke_instance_ready(smoke_base, session_http, request):
|
||||
ok, _ = can_reach_one(smoke_base, session_http)
|
||||
require = os.environ.get("ELEVATOR_SMOKE_REQUIRE", "")
|
||||
if not ok and not require:
|
||||
pytest.skip(f"单机 {smoke_base} 健康检查不通过(跳过 smoke)")
|
||||
if not ok and require:
|
||||
pytest.fail(f"ELEVATOR_SMOKE_REQUIRE=1 且 {smoke_base} 不可达")
|
||||
return True
|
||||
|
||||
|
||||
def _write_smoke_report(config, srows: list, report_dir: Path) -> None:
|
||||
from report import generate_smoke_report
|
||||
|
||||
label = str(config.getoption("--smoke-label", default="smoke"))
|
||||
p2 = report_dir / f"smoke-{label}-{datetime.now().strftime('%Y%m%d-%H%M%S')}.md"
|
||||
generate_smoke_report.write_file(
|
||||
p2,
|
||||
str(config.getoption("--smoke-base", default="")),
|
||||
label,
|
||||
srows,
|
||||
)
|
||||
print(f"\n[smoke] 报告: {p2}")
|
||||
|
||||
|
||||
def pytest_sessionfinish(session, exitstatus):
|
||||
rows = getattr(session.config, "_parity_rows", None)
|
||||
if not rows:
|
||||
return
|
||||
try:
|
||||
from report import generate_report
|
||||
import importlib
|
||||
|
||||
p = _DIR / "report" / generate_report.timestamped_name("parity")
|
||||
p.parent.mkdir(parents=True, exist_ok=True)
|
||||
generate_report.write_file(
|
||||
p,
|
||||
str(session.config.getoption("--base-old", default="")),
|
||||
str(session.config.getoption("--base-new", default="")),
|
||||
rows,
|
||||
)
|
||||
print(f"\n[parity] 报告: {p}")
|
||||
except Exception as e:
|
||||
print(f"\n[parity] 报告未生成: {e}")
|
||||
config = session.config
|
||||
report_dir = _DIR / "report"
|
||||
report_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
rows = getattr(config, "_parity_rows", None) or []
|
||||
if rows:
|
||||
try:
|
||||
gen = importlib.import_module("report.generate_report")
|
||||
p = report_dir / gen.timestamped_name("parity")
|
||||
gen.write_file(
|
||||
p,
|
||||
str(config.getoption("--base-old", default="")),
|
||||
str(config.getoption("--base-new", default="")),
|
||||
rows,
|
||||
)
|
||||
print(f"\n[parity] 对拍报告: {p}")
|
||||
except Exception as e:
|
||||
print(f"\n[parity] 对拍报告未生成: {e}")
|
||||
|
||||
def load_catalog() -> dict:
|
||||
from parity import catalog_loader
|
||||
|
||||
return catalog_loader.load()
|
||||
srows = getattr(config, "_smoke_rows", None) or []
|
||||
if srows:
|
||||
try:
|
||||
_write_smoke_report(config, srows, report_dir)
|
||||
except Exception as e:
|
||||
print(f"\n[smoke] 报告未生成: {e}")
|
||||
|
||||
Reference in New Issue
Block a user