From b665ebfeac5cc4a1feecdf410bd2b2cba17c5ea0 Mon Sep 17 00:00:00 2001 From: BruceChen Date: Sun, 12 Apr 2026 20:46:39 +0800 Subject: [PATCH] Add session-scoped dual-session smoke test and harness updates --- .../scripts/reset_shared_test_state.sh | 6 +- .../scripts/run_full_spectrum_test.sh | 99 ++++----- .../run_parallel_session_smoke_test.sh | 197 ++++++++++++++++++ tools/run-creative-e2e.sh | 43 ++-- 4 files changed, 272 insertions(+), 73 deletions(-) create mode 100755 .skills/mcc-integration-testing/scripts/run_parallel_session_smoke_test.sh diff --git a/.skills/mcc-integration-testing/scripts/reset_shared_test_state.sh b/.skills/mcc-integration-testing/scripts/reset_shared_test_state.sh index 2d84ac1b..f3945e1a 100755 --- a/.skills/mcc-integration-testing/scripts/reset_shared_test_state.sh +++ b/.skills/mcc-integration-testing/scripts/reset_shared_test_state.sh @@ -12,7 +12,7 @@ usage() { cat <<'EOF' Usage: reset_shared_test_state.sh [--all | ...] -Kills shared tmux test sessions and removes stale stdin pipes. +Kills shared server tmux test sessions and removes stale server stdin pipes. EOF } @@ -26,8 +26,6 @@ kill_named_session() { tmux kill-session -t "$session_name" 2>/dev/null || true } -kill_named_session "mcc-debug" - if [[ $# -eq 0 || "${1:-}" == "--all" ]]; then while IFS= read -r session_name; do [[ -z "$session_name" ]] && continue @@ -46,5 +44,3 @@ else remove_stale_stdin_pipe "$version" done fi - -rm -f "$MCC_REPO/mcc_input.txt" diff --git a/.skills/mcc-integration-testing/scripts/run_full_spectrum_test.sh b/.skills/mcc-integration-testing/scripts/run_full_spectrum_test.sh index 51021974..4cfb5ae9 100755 --- a/.skills/mcc-integration-testing/scripts/run_full_spectrum_test.sh +++ b/.skills/mcc-integration-testing/scripts/run_full_spectrum_test.sh @@ -17,23 +17,22 @@ RUN_ROOT="${TMPDIR:-/tmp}/mcc-integration-testing" RUN_ID="$(date +%Y%m%d-%H%M%S)" RUN_DIR="$RUN_ROOT/$RUN_ID" SERVER_LOG_FILE="$MCC_SERVERS/$VERSION/logs/latest.log" -MCC_LOG="$RUN_DIR/mcc.log" +SESSION_NAME="full-spectrum-${MC_VERSION//[^a-zA-Z0-9]/_}" +TEST_USERNAME="CursorBot" +MCC_LOG="$(_mcc_session_log_file "$SESSION_NAME")" BUILD_LOG="$RUN_DIR/build.log" SERVER_TMUX_LOG="$RUN_DIR/server-tmux.log" SERVER_FILE_LOG="$RUN_DIR/server-latest.log" -INPUT_FILE="$REPO_ROOT/mcc_input.txt" +INPUT_FILE="$(_mcc_session_input_file "$SESSION_NAME")" CFG="$RUN_DIR/MinecraftClient.$MC_VERSION.ini" MCC_PID="" mkdir -p "$RUN_DIR" cleanup() { - if [[ -n "${MCC_PID:-}" ]] && kill -0 "$MCC_PID" 2>/dev/null; then - mcc-cmd "quit" >/dev/null 2>&1 || true - sleep 2 - kill "$MCC_PID" 2>/dev/null || true - wait "$MCC_PID" 2>/dev/null || true - fi + mcc-cmd --session "$SESSION_NAME" "quit" >/dev/null 2>&1 || true + sleep 2 + mcc-kill --session "$SESSION_NAME" >/dev/null 2>&1 || true mc-stop "$VERSION" >/dev/null 2>&1 || true wait_for_server_stop "$VERSION" 20 >/dev/null 2>&1 || true @@ -41,7 +40,7 @@ cleanup() { trap cleanup EXIT prepare_config() { - bash "$SCRIPT_DIR/prepare_offline_mcc_config.sh" "$CFG" "$MC_VERSION" CursorBot >/dev/null + bash "$SCRIPT_DIR/prepare_offline_mcc_config.sh" "$CFG" "$MC_VERSION" "$TEST_USERNAME" >/dev/null } wait_for_server_log_pattern() { @@ -129,19 +128,22 @@ run_server_command() { run_mcc_command() { local cmd="$1" echo "MCC> $cmd" - mcc-cmd "$cmd" + mcc-cmd --session "$SESSION_NAME" "$cmd" sleep 2 } bash "$SCRIPT_DIR/preflight_test_env.sh" "$VERSION" >/dev/null bash "$SCRIPT_DIR/reset_shared_test_state.sh" "$VERSION" >/dev/null "$SCRIPT_DIR/ensure_offline_server.sh" "$VERSION" +mcc-reset-session --session "$SESSION_NAME" >/dev/null echo "Building MCC..." mcc-build > "$BUILD_LOG" 2>&1 || fail "mcc-build failed" prepare_config SERVER_PORT="$(bash "$SCRIPT_DIR/get_server_port.sh" "$VERSION")" +mkdir -p "$(dirname "$INPUT_FILE")" "$(dirname "$MCC_LOG")" : > "$INPUT_FILE" +rm -f "$MCC_LOG" echo "Starting server..." mc-start "$VERSION" >/dev/null @@ -150,14 +152,15 @@ wait_for_server_ready "$VERSION" || fail "Server did not become ready" echo "Starting MCC..." ( cd "$REPO_ROOT" - MCC_FILE_INPUT=1 dotnet run --project MinecraftClient -c Release --no-build -- "$CFG" CursorBot - "localhost:$SERVER_PORT" > "$MCC_LOG" 2>&1 + MCC_FILE_INPUT=1 MCC_INPUT_FILE="$INPUT_FILE" \ + dotnet run --project MinecraftClient -c Release --no-build -- "$CFG" "$TEST_USERNAME" - "localhost:$SERVER_PORT" > "$MCC_LOG" 2>&1 ) & MCC_PID=$! wait_for_file_pattern "$MCC_LOG" "Server was successfully joined." "MCC join success" 90 || fail "MCC failed to join" -wait_for_server_log_pattern "CursorBot joined the game" "server join entry" 30 || fail "Server never logged the join" +wait_for_server_log_pattern "$TEST_USERNAME joined the game" "server join entry" 30 || fail "Server never logged the join" -run_server_command "op CursorBot" +run_server_command "op $TEST_USERNAME" run_server_command "gamerule sendCommandFeedback true" run_server_command "gamerule logAdminCommands true" run_server_command "time set day" @@ -176,7 +179,7 @@ run_mcc_command "/time query daytime" run_mcc_command "smoke_test_from_mcc_full_spectrum" # ── Phase 2: Movement and look commands ── -run_mcc_command "/tp CursorBot 0 -60 0" +run_mcc_command "/tp $TEST_USERNAME 0 -60 0" sleep 3 run_mcc_command "look up" sleep 1 @@ -193,35 +196,35 @@ run_mcc_command "inventory creativeclear 38" run_mcc_command "inventory player list" # ── Phase 4: Block placement and interaction ── -run_server_command "execute as CursorBot at @s run fill ~1 ~ ~1 ~3 ~2 ~3 minecraft:stone" +run_server_command "execute as $TEST_USERNAME at @s run fill ~1 ~ ~1 ~3 ~2 ~3 minecraft:stone" sleep 2 -run_server_command "execute as CursorBot at @s run setblock ~5 ~ ~5 minecraft:chest" +run_server_command "execute as $TEST_USERNAME at @s run setblock ~5 ~ ~5 minecraft:chest" sleep 1 -run_server_command "execute as CursorBot at @s run setblock ~5 ~1 ~5 minecraft:furnace" +run_server_command "execute as $TEST_USERNAME at @s run setblock ~5 ~1 ~5 minecraft:furnace" sleep 1 -run_server_command "execute as CursorBot at @s run setblock ~6 ~ ~5 minecraft:crafting_table" +run_server_command "execute as $TEST_USERNAME at @s run setblock ~6 ~ ~5 minecraft:crafting_table" sleep 1 # ── Phase 5: Entity spawning (expanded coverage) ── -run_server_command "execute as CursorBot at @s run summon minecraft:cow ~2 ~ ~" -run_server_command "execute as CursorBot at @s run summon minecraft:zombie ~4 ~ ~" -run_server_command "execute as CursorBot at @s run summon minecraft:creeper ~6 ~ ~" -run_server_command "execute as CursorBot at @s run summon minecraft:skeleton ~8 ~ ~" -run_server_command "execute as CursorBot at @s run summon minecraft:villager ~-2 ~ ~" -run_server_command "execute as CursorBot at @s run summon minecraft:allay ~-4 ~ ~" -run_server_command "execute as CursorBot at @s run summon minecraft:armor_stand ~ ~ ~2" -run_server_command "execute as CursorBot at @s run summon minecraft:item_display ~-6 ~ ~ {item:{id:\"minecraft:diamond\",count:1}}" -run_server_command "execute as CursorBot at @s run summon minecraft:spider ~10 ~ ~" -run_server_command "execute as CursorBot at @s run summon minecraft:pig ~-8 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:cow ~2 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:zombie ~4 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:creeper ~6 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:skeleton ~8 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:villager ~-2 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:allay ~-4 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:armor_stand ~ ~ ~2" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:item_display ~-6 ~ ~ {item:{id:\"minecraft:diamond\",count:1}}" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:spider ~10 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:pig ~-8 ~ ~" sleep 2 run_mcc_command "entity" # ── Phase 6: Effects and environment ── -run_server_command "effect give CursorBot minecraft:speed 30 1" +run_server_command "effect give $TEST_USERNAME minecraft:speed 30 1" sleep 2 run_mcc_command "health" -run_server_command "effect give CursorBot minecraft:regeneration 10 1" +run_server_command "effect give $TEST_USERNAME minecraft:regeneration 10 1" sleep 2 run_mcc_command "health" @@ -233,39 +236,39 @@ run_mcc_command "/gamemode creative" sleep 2 # ── Phase 8: Dimension change (nether) ── -run_server_command "execute in minecraft:the_nether run tp CursorBot 0 64 0" +run_server_command "execute in minecraft:the_nether run tp $TEST_USERNAME 0 64 0" sleep 4 run_mcc_command "health" -run_server_command "execute in minecraft:overworld run tp CursorBot 0 -60 0" +run_server_command "execute in minecraft:overworld run tp $TEST_USERNAME 0 -60 0" sleep 4 # ── Phase 9: Server chat and whisper ── run_server_command "say Hello from the server console" sleep 2 -run_server_command "msg CursorBot This is a private whisper" +run_server_command "msg $TEST_USERNAME This is a private whisper" sleep 2 run_mcc_command "integration_test_chat_response" # ── Phase 10: Particles, sounds, and explosions ── -run_server_command "execute as CursorBot at @s run particle minecraft:happy_villager ~ ~1 ~ 0.5 0.5 0.5 0 12 force" -run_server_command "execute as CursorBot at @s run particle minecraft:end_rod ~ ~1 ~ 0.5 0.5 0.5 0.01 20 force" -run_server_command "execute as CursorBot at @s run particle minecraft:explosion ~ ~1 ~ 0 0 0 0 1 force" -run_server_command "execute as CursorBot at @s run particle minecraft:totem_of_undying ~ ~1 ~ 0.5 0.5 0.5 0.1 20 force" -run_server_command "execute as CursorBot at @s run particle minecraft:flame ~ ~1 ~ 0.2 0.2 0.2 0.02 30 force" -run_server_command "execute as CursorBot at @s run particle minecraft:heart ~ ~2 ~ 0.3 0.3 0.3 0 5 force" +run_server_command "execute as $TEST_USERNAME at @s run particle minecraft:happy_villager ~ ~1 ~ 0.5 0.5 0.5 0 12 force" +run_server_command "execute as $TEST_USERNAME at @s run particle minecraft:end_rod ~ ~1 ~ 0.5 0.5 0.5 0.01 20 force" +run_server_command "execute as $TEST_USERNAME at @s run particle minecraft:explosion ~ ~1 ~ 0 0 0 0 1 force" +run_server_command "execute as $TEST_USERNAME at @s run particle minecraft:totem_of_undying ~ ~1 ~ 0.5 0.5 0.5 0.1 20 force" +run_server_command "execute as $TEST_USERNAME at @s run particle minecraft:flame ~ ~1 ~ 0.2 0.2 0.2 0.02 30 force" +run_server_command "execute as $TEST_USERNAME at @s run particle minecraft:heart ~ ~2 ~ 0.3 0.3 0.3 0 5 force" -run_server_command "execute as CursorBot at @s run playsound minecraft:entity.lightning_bolt.thunder master CursorBot ~ ~ ~ 1 1 0" -run_server_command "execute as CursorBot at @s run playsound minecraft:block.note_block.bell master CursorBot ~ ~ ~ 1 1 0" -run_server_command "execute as CursorBot at @s run playsound minecraft:entity.experience_orb.pickup master CursorBot ~ ~ ~ 1 1 0" +run_server_command "execute as $TEST_USERNAME at @s run playsound minecraft:entity.lightning_bolt.thunder master $TEST_USERNAME ~ ~ ~ 1 1 0" +run_server_command "execute as $TEST_USERNAME at @s run playsound minecraft:block.note_block.bell master $TEST_USERNAME ~ ~ ~ 1 1 0" +run_server_command "execute as $TEST_USERNAME at @s run playsound minecraft:entity.experience_orb.pickup master $TEST_USERNAME ~ ~ ~ 1 1 0" -run_server_command "execute as CursorBot at @s run summon minecraft:tnt ~3 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:tnt ~3 ~ ~" sleep 2 -run_server_command "execute as CursorBot at @s run summon minecraft:tnt ~6 ~ ~" +run_server_command "execute as $TEST_USERNAME at @s run summon minecraft:tnt ~6 ~ ~" # ── Phase 11: Kill and respawn cycle ── run_mcc_command "/gamemode survival" sleep 2 -run_server_command "kill CursorBot" +run_server_command "kill $TEST_USERNAME" sleep 4 run_mcc_command "respawn" sleep 4 @@ -295,14 +298,14 @@ assert_not_contains "$MCC_LOG" "Failed to load settings" "MCC failed to reload i assert_not_contains "$MCC_LOG" "NullReferenceException" "A NullReferenceException occurred during the test" # ── Assertions: Server log ── -assert_contains "$SERVER_FILE_LOG" "CursorBot joined the game" "Server never saw CursorBot join" +assert_contains "$SERVER_FILE_LOG" "$TEST_USERNAME joined the game" "Server never saw $TEST_USERNAME join" assert_contains "$SERVER_FILE_LOG" "smoke_test_from_mcc_full_spectrum" "Server never received the client chat message" assert_contains "$SERVER_FILE_LOG" "Displaying particle minecraft:happy_villager" "Particle events were not recorded on the server" -assert_contains "$SERVER_FILE_LOG" "Played sound minecraft:block.note_block.bell to CursorBot" "Sound events were not recorded on the server" +assert_contains "$SERVER_FILE_LOG" "Played sound minecraft:block.note_block.bell to $TEST_USERNAME" "Sound events were not recorded on the server" assert_contains "$SERVER_FILE_LOG" "Summoned new Primed TNT" "TNT summon did not occur on the server" assert_contains "$SERVER_FILE_LOG" "integration_test_chat_response" "Server never received the chat response test message" assert_contains "$SERVER_FILE_LOG" "Hello from the server console" "Server say command was not logged" -assert_contains "$SERVER_FILE_LOG" "Killed CursorBot" "Server kill command did not execute" +assert_contains "$SERVER_FILE_LOG" "Killed $TEST_USERNAME" "Server kill command did not execute" assert_not_contains "$SERVER_FILE_LOG" "Sending unknown packet 'clientbound/minecraft:disconnect'" "Server hit the disconnect packet regression during the test" cat <&2 + return 1 +} + +wait_for_server_log_pattern() { + local pattern="$1" + local description="$2" + local timeout="${3:-60}" + local elapsed=0 + + while (( elapsed < timeout )); do + if [[ -f "$SERVER_LOG_FILE" ]] && grep -Fq "$pattern" "$SERVER_LOG_FILE"; then + return 0 + fi + sleep 1 + ((elapsed += 1)) + done + + echo "Timed out waiting for server log: $description" >&2 + return 1 +} + +capture_server_logs() { + mc-log "$VERSION" 400 > "$SERVER_TMUX_LOG" 2>/dev/null || true + if [[ -f "$SERVER_LOG_FILE" ]]; then + cp "$SERVER_LOG_FILE" "$SERVER_FILE_LOG" + fi +} + +fail() { + capture_server_logs + echo "FAIL: $1" >&2 + echo "Run directory: $RUN_DIR" >&2 + exit 1 +} + +cleanup() { + mcc-cmd --session "$SESSION_A" "quit" >/dev/null 2>&1 || true + mcc-cmd --session "$SESSION_B" "quit" >/dev/null 2>&1 || true + sleep 1 + mcc-kill --session "$SESSION_A" >/dev/null 2>&1 || true + mcc-kill --session "$SESSION_B" >/dev/null 2>&1 || true + mc-stop "$VERSION" >/dev/null 2>&1 || true + wait_for_server_stop "$VERSION" 20 >/dev/null 2>&1 || true +} +trap cleanup EXIT + +assert_session_alive() { + local session="$1" + local pid_file="$2" + if [[ -s "$pid_file" ]]; then + local pid + pid="$(tr -cd '0-9' < "$pid_file")" + if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then + return 0 + fi + fi + + tmux has-session -t "$(_mcc_tmux_session_name "$session")" 2>/dev/null +} + +assert_server_alive() { + server_running "$VERSION" || fail "Shared server session is not alive" +} + +start_file_input_session() { + local session="$1" + local username="$2" + bash "$REPO_ROOT/tools/mcc-debug.sh" \ + --version "$VERSION" \ + --file-input \ + --no-build \ + --session "$session" \ + --username "$username" >/dev/null +} + +bash "$SCRIPT_DIR/preflight_test_env.sh" "$VERSION" >/dev/null +bash "$SCRIPT_DIR/reset_shared_test_state.sh" "$VERSION" >/dev/null +"$SCRIPT_DIR/ensure_offline_server.sh" "$VERSION" >/dev/null +mcc-reset-session --session "$SESSION_A" >/dev/null +mcc-reset-session --session "$SESSION_B" >/dev/null + +echo "Building MCC..." +mcc-build > "$BUILD_LOG" 2>&1 || fail "mcc-build failed" + +echo "Starting shared server..." +mc-start "$VERSION" >/dev/null +wait_for_server_ready "$VERSION" || fail "Server did not become ready" +SERVER_PORT="$(bash "$SCRIPT_DIR/get_server_port.sh" "$VERSION")" +if [[ -z "$SERVER_PORT" ]]; then + fail "Failed to resolve server port" +fi + +echo "Starting MCC session A..." +start_file_input_session "$SESSION_A" "$USERNAME_A" +echo "Starting MCC session B..." +start_file_input_session "$SESSION_B" "$USERNAME_B" + +wait_for_file_pattern "$LOG_A" "Server was successfully joined." "session A join success" 90 || fail "Session A failed to join" +wait_for_file_pattern "$LOG_B" "Server was successfully joined." "session B join success" 90 || fail "Session B failed to join" +wait_for_server_log_pattern "$USERNAME_A joined the game" "server join for session A" 30 || fail "Server never logged $USERNAME_A join" +wait_for_server_log_pattern "$USERNAME_B joined the game" "server join for session B" 30 || fail "Server never logged $USERNAME_B join" + +echo "Sending debug state to both sessions..." +mcc-cmd --session "$SESSION_A" "debug state" +mcc-cmd --session "$SESSION_B" "debug state" +sleep 2 +wait_for_file_pattern "$LOG_A" "[FileInput] > debug state" "session A debug state command" 20 || fail "Session A did not consume debug state" +wait_for_file_pattern "$LOG_B" "[FileInput] > debug state" "session B debug state command" 20 || fail "Session B did not consume debug state" + +echo "Killing session A..." +mcc-kill --session "$SESSION_A" >/dev/null 2>&1 || true +sleep 2 + +assert_session_alive "$SESSION_B" "$PID_B_FILE" || fail "Session B is not alive after killing session A" +assert_server_alive + +echo "Verifying session B still responds..." +mcc-cmd --session "$SESSION_B" "health" +wait_for_file_pattern "$LOG_B" "[FileInput] > health" "session B health command after session A kill" 20 || fail "Session B stopped responding after session A kill" + +if [[ -s "$PID_A_FILE" ]]; then + pid_a="$(tr -cd '0-9' < "$PID_A_FILE")" + if [[ -n "$pid_a" ]] && kill -0 "$pid_a" 2>/dev/null; then + fail "Session A is still alive after mcc-kill" + fi +fi + +capture_server_logs + +cat </dev/null; then - echo "quit" >> "$INPUT_FILE" 2>/dev/null || true + mcc-cmd --session "$MCC_SESSION" "quit" >/dev/null 2>&1 || true sleep 2 - kill "$MCC_PID" 2>/dev/null || true - wait "$MCC_PID" 2>/dev/null || true fi + mcc-kill --session "$MCC_SESSION" >/dev/null 2>&1 || true if [[ -p "$MCC_SERVERS/$SERVER_DIR/stdin.pipe" ]]; then echo "stop" > "$MCC_SERVERS/$SERVER_DIR/stdin.pipe" 2>/dev/null || true @@ -100,7 +101,7 @@ trap cleanup EXIT prepare_config() { MCC_TEST_ACCOUNT_TYPE=mojang MCC_TEST_PASSWORD=- \ bash "$REPO_ROOT/.skills/mcc-integration-testing/scripts/prepare_offline_mcc_config.sh" \ - "$REPO_ROOT/MinecraftClient.ini" "$CFG" "$MC_VERSION" CursorBot >/dev/null + "$CFG" "$MC_VERSION" "$TEST_USERNAME" >/dev/null sed_in_place \ -e "s#^Server = .*#Server = { Host = \"localhost\", Port = $SERVER_PORT }#" \ @@ -115,7 +116,7 @@ prepare_config() { send_mcc_command() { local command="$1" local delay="${2:-2}" - echo "$command" >> "$INPUT_FILE" + mcc-cmd --session "$MCC_SESSION" "$command" sleep "$delay" } @@ -151,9 +152,9 @@ legacy_server_setup() { run_server_command "gamerule sendCommandFeedback true" run_server_command "time set day" run_server_command "weather clear" - run_server_command "gamemode creative CursorBot" + run_server_command "gamemode creative $TEST_USERNAME" run_server_command "fill -2 79 -2 2 79 2 stone" - run_server_command "tp CursorBot 0 80 0" + run_server_command "tp $TEST_USERNAME 0 80 0" } modern_server_setup() { @@ -161,30 +162,32 @@ modern_server_setup() { run_server_command "gamerule logAdminCommands true" run_server_command "time set day" run_server_command "weather clear" - run_server_command "gamemode creative CursorBot" + run_server_command "gamemode creative $TEST_USERNAME" run_server_command "fill -2 79 -2 2 79 2 stone" - run_server_command "tp CursorBot 0 80 0" + run_server_command "tp $TEST_USERNAME 0 80 0" } legacy_mob_and_effects() { run_server_command "summon Cow 2 80 0" run_server_command "summon Zombie 4 80 0" run_server_command "summon Pig -2 80 0" - run_server_command "effect CursorBot 1 30 1 true" - run_server_command "effect CursorBot 10 10 1 true" + run_server_command "effect $TEST_USERNAME 1 30 1 true" + run_server_command "effect $TEST_USERNAME 10 10 1 true" } modern_mob_and_effects() { run_server_command "summon minecraft:cow 2 80 0" run_server_command "summon minecraft:zombie 4 80 0" run_server_command "summon minecraft:pig -2 80 0" - run_server_command "effect give CursorBot minecraft:speed 30 1 true" - run_server_command "effect give CursorBot minecraft:regeneration 10 1 true" + run_server_command "effect give $TEST_USERNAME minecraft:speed 30 1 true" + run_server_command "effect give $TEST_USERNAME minecraft:regeneration 10 1 true" } bash "$REPO_ROOT/.skills/mcc-integration-testing/scripts/preflight_test_env.sh" "$SERVER_DIR" >/dev/null bash "$REPO_ROOT/.skills/mcc-integration-testing/scripts/reset_shared_test_state.sh" --all >/dev/null +mcc-reset-session --session "$MCC_SESSION" >/dev/null wait_for_rcon_port_free 30 || true +mkdir -p "$(dirname "$MCC_LOG")" "$(dirname "$INPUT_FILE")" rm -f "$MCC_LOG" "$INPUT_FILE" bash "$REPO_ROOT/.skills/mcc-integration-testing/scripts/ensure_offline_server.sh" "$SERVER_DIR" >/dev/null @@ -201,9 +204,9 @@ prepare_config ( cd "$REPO_ROOT" - MCC_FILE_INPUT=1 dotnet run --project MinecraftClient -c Release --no-build -- \ + MCC_FILE_INPUT=1 MCC_INPUT_FILE="$INPUT_FILE" dotnet run --project MinecraftClient -c Release --no-build -- \ "$CFG" \ - CursorBot \ + "$TEST_USERNAME" \ - \ "localhost:$SERVER_PORT" \ > "$MCC_LOG" 2>&1 @@ -211,10 +214,10 @@ prepare_config MCC_PID=$! assert_log_contains "$MCC_LOG" "Server was successfully joined." "MCC join success" 90 -assert_log_contains "$SERVER_LOG_FILE" "CursorBot joined the game" "server join entry" 30 +assert_log_contains "$SERVER_LOG_FILE" "$TEST_USERNAME joined the game" "server join entry" 30 print_phase "CONNECT" "PASS" -run_server_command "op CursorBot" +run_server_command "op $TEST_USERNAME" sleep 1 if [[ "$PROFILE" == "legacy" ]]; then @@ -237,7 +240,7 @@ assert_log_contains "$SERVER_LOG_FILE" "$cmd_token" "client command on server" 2 print_phase "SEND" "PASS" run_server_command "say $broadcast_token" -run_server_command "tell CursorBot $whisper_token" +run_server_command "tell $TEST_USERNAME $whisper_token" assert_log_contains "$MCC_LOG" "$broadcast_token" "server broadcast in MCC" 20 assert_log_contains "$MCC_LOG" "$whisper_token" "server whisper in MCC" 20 print_phase "RECEIVE" "PASS"