mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
docs+test: 发布包对拍计划、pytest 双端 API 对拍与 run_elevator_parity 脚本
- docs/elevator-api-parity: 计划/报告模板/示例 - tools/elevator_api_parity: 端点目录、fixtures、对拍 client/compare、报告生成 - scripts/run_elevator_parity: JDK8 构建 + 单测/对拍(无服务时跳过对拍用例) Made-with: Cursor Former-commit-id: 3d54a40e1a7ae0b1724261d4f18910a6f415f853
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# 本脚本位于 maven-cw-elevator-application/scripts/:先打新包,再跑对拍用例与报告
|
||||
set -e
|
||||
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
TOOL="${REPO}/tools/elevator_api_parity"
|
||||
JAR_NEW="${REPO}/cw-elevator-application-starter/target/cw-elevator-application-2.0.0.jar"
|
||||
JAR_LEGACY_DEFAULT="$(cd "$REPO/.." && pwd)/cw-elevator-application-V1.0.0.20211103/cw-elevator-application-V1.0.0.20211103.jar"
|
||||
JAR_LEGACY="${ELEVATOR_JAR_LEGACY:-$JAR_LEGACY_DEFAULT}"
|
||||
|
||||
if [[ -z "${JAVA_8:-}" ]]; then
|
||||
for d in /usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/java-1.8.0-openjdk; do
|
||||
if [[ -x "$d/bin/java" ]]; then
|
||||
export JAVA_8="$d"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
: "${JAVA_8:=/usr/lib/jvm/java-8-openjdk-amd64}"
|
||||
export JAVA_HOME="$JAVA_8"
|
||||
export PATH="$JAVA_HOME/bin:$PATH"
|
||||
|
||||
cd "$REPO"
|
||||
echo "==> mvn package (skip tests)"
|
||||
mvn -q -DskipTests clean package
|
||||
echo "==> 新 JAR: $JAR_NEW [$(test -f "$JAR_NEW" && echo OK || echo 缺失)]"
|
||||
echo "==> 基线 JAR(路径): $JAR_LEGACY [$(test -f "$JAR_LEGACY" && echo 存在 || echo 不存在,可设ELEVATOR_JAR_LEGACY)]"
|
||||
echo " (对拍为 HTTP; 需另开终端分别 java -jar --server.port=18080/18081 与相同配置)"
|
||||
(cd "$TOOL" && pip install -q -r requirements.txt 2>/dev/null || pip3 install -q -r requirements.txt 2>/dev/null || true)
|
||||
echo "==> 单元(无联调): test_unit_compare"
|
||||
export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
|
||||
(cd "$TOOL" && python3 -m pytest tests/test_unit_compare.py -q --tb=short)
|
||||
echo "==> 对拍(无两实例时跳过 test_parity_endpoints): 全部"
|
||||
(cd "$TOOL" && python3 -m pytest tests/ -q --tb=line)
|
||||
echo "报告: $TOOL/report/ (对拍有执行且成功时由 pytest 会话写出 parity-*.md)"
|
||||
Reference in New Issue
Block a user