Replace sleep with wait-for-tcp script in run-tests.sh and CI workflow to improve reliability of smoke tests. Update TESTING.md to include prerequisites for the new script.
All checks were successful
Smoke tests / Build and smoke test (push) Successful in 1m17s

This commit is contained in:
AI Agent
2026-03-19 15:47:21 -06:00
parent 1a545bbae7
commit 0914b5a32b
4 changed files with 29 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ name: Smoke tests
on:
workflow_dispatch:
push:
pull_request:
jobs:
smoke:
@@ -14,10 +15,14 @@ jobs:
uses: actions/checkout@v4
- name: Install needed tools
env:
DEBIAN_FRONTEND: noninteractive
run: |
set -e
sudo apt-get update
sudo apt-get install -y --no-install-recommends openssh-client netcat-openbsd ca-certificates curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
sudo apt update && sudo apt install -y netcat-openbsd
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Build
run: cargo build
@@ -34,7 +39,7 @@ jobs:
RUST_LOG=info ./target/debug/mudserver -d "$TEST_DB" &
MUD_PID=$!
trap 'kill $MUD_PID 2>/dev/null || true' EXIT
sleep 2
bash scripts/ci/wait-for-tcp.sh 127.0.0.1 2222
set +e
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 smoketest@localhost <<'EOF'
1
@@ -56,13 +61,13 @@ jobs:
set -e
[[ $r -eq 0 || $r -eq 255 ]]
- name: Smoke persistence (reconnect)
- name: Smoke - persistence (reconnect)
run: |
set -euo pipefail
RUST_LOG=info ./target/debug/mudserver -d "$TEST_DB" &
MUD_PID=$!
trap 'kill $MUD_PID 2>/dev/null || true' EXIT
sleep 2
bash scripts/ci/wait-for-tcp.sh 127.0.0.1 2222
set +e
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 smoketest@localhost <<'EOF'
look
@@ -82,13 +87,13 @@ jobs:
./target/debug/mudtool -d "$TEST_DB" settings set registration_open false
./target/debug/mudtool -d "$TEST_DB" settings list
- name: Smoke in-game admin
- name: Smoke - in-game admin
run: |
set -euo pipefail
RUST_LOG=info ./target/debug/mudserver -d "$TEST_DB" &
MUD_PID=$!
trap 'kill $MUD_PID 2>/dev/null || true' EXIT
sleep 2
bash scripts/ci/wait-for-tcp.sh 127.0.0.1 2222
set +e
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 smoketest@localhost <<'EOF'
admin help
@@ -108,7 +113,7 @@ jobs:
RUST_LOG=info ./target/debug/mudserver -d "$TEST_DB" &
MUD_PID=$!
trap 'kill $MUD_PID 2>/dev/null || true' EXIT
sleep 2
bash scripts/ci/wait-for-tcp.sh 127.0.0.1 2222
set +e
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 newplayer@localhost <<'EOF'
quit
@@ -125,7 +130,7 @@ jobs:
RUST_LOG=info ./target/debug/mudserver -d "$TEST_DB" &
MUD_PID=$!
trap 'kill $MUD_PID 2>/dev/null || true' EXIT
sleep 2
bash scripts/ci/wait-for-tcp.sh 127.0.0.1 2222
set +e
(
echo "1"