|
|
@@ -0,0 +1,62 @@
|
|
|
+#!/usr/bin/env bash
|
|
|
+# R3-RULE-EVALUATOR-CLOSEOUT-1 unified regression driver (dev/test only, aidopdev).
|
|
|
+#
|
|
|
+# Sequentially runs the three per-type regression scripts and summarizes
|
|
|
+# PASS / FAIL. Intended as a single gate before R4 (rule config UI) work, so
|
|
|
+# any UI / schema change can be validated against all three evaluator main
|
|
|
+# chains at once.
|
|
|
+#
|
|
|
+# Each child script self-validates DB_NAME=aidopdev and storage-state token,
|
|
|
+# so this driver does not duplicate those checks. On first FAIL the driver
|
|
|
+# exits non-zero with the failing script name; remaining scripts are skipped.
|
|
|
+
|
|
|
+set -euo pipefail
|
|
|
+
|
|
|
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
+PROJECT_DIR="${PROJECT_DIR:-$(cd "${SCRIPT_DIR}/../.." && pwd)}"
|
|
|
+DB_HOST="${DB_HOST:-123.60.180.165}"
|
|
|
+DB_PORT="${DB_PORT:-3306}"
|
|
|
+DB_NAME="${DB_NAME:-aidopdev}"
|
|
|
+DB_USER="${DB_USER:-aidopremote}"
|
|
|
+DB_PASS="${DB_PASS:-1234567890aiDOP#}"
|
|
|
+
|
|
|
+fail() { echo "FAIL: $*" >&2; exit 1; }
|
|
|
+ok() { echo "OK: $*"; }
|
|
|
+
|
|
|
+[[ "${DB_NAME}" == "aidopdev" ]] || fail "DB_NAME must be aidopdev, got ${DB_NAME}"
|
|
|
+
|
|
|
+mysql_query() {
|
|
|
+ MYSQL_PWD="${DB_PASS}" mysql -h "${DB_HOST}" -P "${DB_PORT}" -u "${DB_USER}" "${DB_NAME}" \
|
|
|
+ --default-character-set=utf8mb4 --connect-timeout=8 -N -B -e "$1" 2>/dev/null
|
|
|
+}
|
|
|
+
|
|
|
+baseline=$(mysql_query "SELECT COUNT(*) FROM ado_s8_exception_type WHERE tenant_id=0 AND factory_id=0;")
|
|
|
+[[ "${baseline}" == "13" ]] || fail "baseline regression: expected 13, got ${baseline}"
|
|
|
+ok "baseline = 13"
|
|
|
+
|
|
|
+run_child() {
|
|
|
+ local label="$1"
|
|
|
+ local script="$2"
|
|
|
+ [[ -x "${script}" ]] || fail "${label}: script not executable: ${script}"
|
|
|
+ echo "===> ${label}: ${script}"
|
|
|
+ if bash "${script}"; then
|
|
|
+ ok "${label} PASS"
|
|
|
+ else
|
|
|
+ fail "${label} FAILED (see output above): ${script}"
|
|
|
+ fi
|
|
|
+}
|
|
|
+
|
|
|
+run_child "TIMEOUT" "${SCRIPT_DIR}/r2-timeout-regression.sh"
|
|
|
+run_child "SHORTAGE" "${SCRIPT_DIR}/r3-shortage-regression.sh"
|
|
|
+run_child "OUT_OF_RANGE" "${SCRIPT_DIR}/r3-out-of-range-regression.sh"
|
|
|
+
|
|
|
+# Post-suite invariants: each evaluator's sample exception remains active and unique.
|
|
|
+oor_active=$(mysql_query "SELECT COUNT(*) FROM ado_s8_exception WHERE source_rule_code='G01_TEST_WATCH' AND status<>'CLOSED' AND is_deleted=0;")
|
|
|
+to_active=$(mysql_query "SELECT COUNT(*) FROM ado_s8_exception WHERE source_rule_code='G01_TEST_TIMEOUT' AND status<>'CLOSED' AND is_deleted=0;")
|
|
|
+sh_active=$(mysql_query "SELECT COUNT(*) FROM ado_s8_exception WHERE source_rule_code='G01_TEST_SHORTAGE' AND status<>'CLOSED' AND is_deleted=0;")
|
|
|
+[[ "${oor_active}" == "1" ]] || fail "OUT_OF_RANGE active count expected 1, got ${oor_active}"
|
|
|
+[[ "${to_active}" == "1" ]] || fail "TIMEOUT active count expected 1, got ${to_active}"
|
|
|
+[[ "${sh_active}" == "1" ]] || fail "SHORTAGE active count expected 1, got ${sh_active}"
|
|
|
+ok "post-suite active counts: OUT_OF_RANGE=1 / TIMEOUT=1 / SHORTAGE=1"
|
|
|
+
|
|
|
+ok "rule evaluator regression PASSED"
|