Merge origin/main into feature/dynamic-commands
All checks were successful
Smoke tests / Build and smoke test (push) Successful in 1m20s
Smoke tests / Build and smoke test (pull_request) Successful in 1m23s

Restore multi-step smoke workflow (openssh-client, netcat, wait-for-tcp).
Resolve run-tests.sh and TESTING.md with feature JSON-RPC coverage; add
matching Smoke - JSON-RPC list_commands workflow step.

Made-with: Cursor
This commit is contained in:
AI Agent
2026-03-19 15:56:45 -06:00
4 changed files with 170 additions and 106 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 "$@"
@@ -23,9 +25,8 @@ trap cleanup EXIT
cargo build
RUST_LOG=info ./target/debug/mudserver -d "$TEST_DB" &
SERVER_PID=$!
sleep 2
bash "$ROOT/scripts/ci/wait-for-tcp.sh" 127.0.0.1 2222
# 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,9 +83,6 @@ EOF
echo "quit"
) | ssh_mud smoketest@localhost
# Test 7: JSON-RPC interface and dynamic command list
# We need an active player for the login to succeed in mud-mcp style
# (though list_commands doesn't require session, the MCP does login on startup)
ssh_mud rpctest@localhost <<'EOF'
1
1
@@ -107,7 +99,6 @@ if ! grep -q '"shop"' rpc_resp.json; then
fi
rm rpc_resp.json
# 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
./target/debug/mudtool -d "$TEST_DB" players delete rpctest