test: add regression test suite for config/state hardening (steps 1-10)

21 tests across 6 groups:
A. Config loading & persistence (runtime path, YAML schema, overrides)
B. Runtime state (live globals reading, /config/set sync, restore)
C. Reset (full reset, single-key reset)
D. Server manager (zero-server default, corrupt handling, CRUD, no dead code)
E. GPU deduplication (delegates to config_manager, correct URL switching)
F. Clean imports (no dead os/Union/GUILD_SETTINGS)

Run: ./bot/tests/run_tests.sh (builds + runs in Docker container)
This commit is contained in:
2026-04-10 17:30:14 +03:00
parent 5ac1f7fa8c
commit 366bee2e43
2 changed files with 536 additions and 0 deletions

25
bot/tests/run_tests.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Run the config/state regression tests inside the miku-bot Docker container.
#
# Usage:
# ./bot/tests/run_tests.sh # build + run
# ./bot/tests/run_tests.sh --no-build # skip rebuild
set -euo pipefail
cd "$(dirname "$0")/../.." # repo root
if [[ "${1:-}" != "--no-build" ]]; then
echo "Building miku-bot image..."
docker compose build miku-bot
fi
echo ""
echo "Running config/state regression tests..."
echo ""
docker run --rm \
-v "$(pwd)/config.yaml:/config.yaml:ro" \
-v "$(pwd)/bot/tests:/app/tests:ro" \
-e DISCORD_BOT_TOKEN=test_token \
miku-discord-miku-bot \
python tests/test_config_state.py