Skip to content

Commit c58590f

Browse files
committed
Fix CI: remove add_child(runner) from watchdog tests
McpTestSuite extends RefCounted (not Node), so add_child(runner) errors at test runtime — Linux/macOS/Windows all failed with the same root cause. The tests fire _on_scan_watchdog_timeout() directly instead of relying on the Timer counting down, so the runner doesn't actually need to be in a SceneTree; the Timer just needs to be a child of the runner (works regardless of where the runner sits).
1 parent e1e0fed commit c58590f

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

test_project/tests/test_update_reload_runner.gd

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,15 @@ func test_watchdog_timeout_proceeds_when_signal_never_fires() -> void:
498498
## `_waiting_for_scan = true` forever. The watchdog must clear that
499499
## flag and dispatch `_scan_next_step` so the rest of the update
500500
## sequence can finish.
501+
## Test fires `_on_scan_watchdog_timeout` directly — the runner does
502+
## not need to be in a SceneTree because we don't depend on the Timer
503+
## actually counting down. (`McpTestSuite` extends `RefCounted`, so
504+
## `add_child(runner)` is not available here.)
501505
var runner = _new_runner()
502-
add_child(runner) # Timer needs a tree to count, but we fire timeout manually
503506
_arm_scan_state(runner)
504507
assert_true(runner._waiting_for_scan, "scan wait armed by precondition")
505508
assert_true(runner._scan_watchdog_timer != null, "watchdog timer node exists once armed")
506509

507-
# Fire the timeout handler directly — equivalent to the Timer's timeout
508-
# signal arriving after 30s of no filesystem_changed.
509510
runner._on_scan_watchdog_timeout()
510511

511512
assert_false(runner._waiting_for_scan, "watchdog cleared the wait flag")
@@ -519,7 +520,6 @@ func test_watchdog_no_op_when_signal_already_settled() -> void:
519520
## `_on_scan_watchdog_timeout` after a settled scan must be a no-op —
520521
## otherwise it would double-dispatch `_scan_next_step`.
521522
var runner = _new_runner()
522-
add_child(runner)
523523
_arm_scan_state(runner)
524524

525525
# Simulate the happy path: signal arrived, _finish_scan_wait ran.
@@ -538,7 +538,6 @@ func test_finish_scan_wait_stops_armed_watchdog() -> void:
538538
## must stop the still-running Timer so it doesn't fire later and
539539
## attempt a second cleanup. Verify by inspecting the Timer state.
540540
var runner = _new_runner()
541-
add_child(runner)
542541
_arm_scan_state(runner)
543542
assert_false(runner._scan_watchdog_timer.is_stopped(), "timer running after arm")
544543

@@ -557,7 +556,6 @@ func test_watchdog_timer_reused_across_arms() -> void:
557556
## a single update (new files, then existing files), so the second arm
558557
## must not leak a second Timer child.
559558
var runner = _new_runner()
560-
add_child(runner)
561559
_arm_scan_state(runner)
562560
var first_timer = runner._scan_watchdog_timer
563561
runner._finish_scan_wait()

0 commit comments

Comments
 (0)