Refactor run-tests.sh to source individual test scripts and update TESTING.md for clarity on smoke test execution. CI now sets SKIP_SMOKE_BUILD to optimize the workflow.
All checks were successful
Smoke tests / Build and smoke test (push) Successful in 1m18s

This commit is contained in:
AI Agent
2026-03-19 15:39:32 -06:00
parent 3a2a606c4a
commit 1a545bbae7
3 changed files with 125 additions and 89 deletions

View File

@@ -1,10 +1,12 @@
#!/usr/bin/env bash
set -ex
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
TEST_DB=${MUD_TEST_DB:-./mudserver.db.test}
SERVER_PID=
# SSH returns 255 when MUD closes connection after quit — treat as success
ssh_mud() {
set +e
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 "$@"
@@ -25,7 +27,6 @@ RUST_LOG=info ./target/debug/mudserver -d "$TEST_DB" &
SERVER_PID=$!
sleep 2
# Test 1: New player creation + basic commands
ssh_mud smoketest@localhost <<'EOF'
1
1
@@ -43,21 +44,18 @@ flee
quit
EOF
# Test 2: Persistence - reconnect
ssh_mud smoketest@localhost <<'EOF'
look
stats
quit
EOF
# Test 3: Admin via mudtool (use same test DB)
./target/debug/mudtool -d "$TEST_DB" players list
./target/debug/mudtool -d "$TEST_DB" players set-admin smoketest true
./target/debug/mudtool -d "$TEST_DB" players show smoketest
./target/debug/mudtool -d "$TEST_DB" settings set registration_open false
./target/debug/mudtool -d "$TEST_DB" settings list
# Test 4: Admin commands in-game
ssh_mud smoketest@localhost <<'EOF'
admin help
admin list
@@ -66,16 +64,13 @@ admin info smoketest
quit
EOF
# Test 5: Registration gate
./target/debug/mudtool -d "$TEST_DB" settings set registration_open false
ssh_mud newplayer@localhost <<'EOF'
quit
EOF
# Test 6: Tick-based combat (connect and wait for ticks)
./target/debug/mudtool -d "$TEST_DB" settings set registration_open true
./target/debug/mudtool -d "$TEST_DB" players delete smoketest
# Use subshell to pipe commands with a delay between them while staying connected
(
echo "1"
echo "1"
@@ -88,6 +83,5 @@ EOF
echo "quit"
) | ssh_mud smoketest@localhost
# Cleanup (trap handles server kill)
./target/debug/mudtool -d "$TEST_DB" settings set registration_open true
./target/debug/mudtool -d "$TEST_DB" players delete smoketest