test: mark PTY-dependent hooks tests as xfail on macOS (#821)#836
Conversation
The macOS PTY kernel buffer timing race condition continues to cause random test failures in CI despite multiple fix attempts (#560, #733, #826). Mark all tests that spawn real subprocesses via PTY and assert on captured logger output as xfail(strict=False) on macOS. This unblocks CI while the root cause is investigated for 0.10.0.
📝 WalkthroughWalkthroughImports ChangesmacOS PTY xfail marker for HookExecutor tests
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Let's see if #837 will fix it before merging this one |
Problem
The alleged macOS PTY kernel buffer timing race condition continues to cause random test failures in CI despite multiple fix attempts:
select()-based drain with timeoutDRAIN_MAX_EMPTY_POLLSfrom 1 to 10Latest failing CI run: https://github.com/jumpstarter-dev/jumpstarter/actions/runs/28084374100/job/83146665529
Each fix reduced the frequency but did not eliminate the race. The CI runs parallel test suites with concurrent package installations, creating enough I/O contention for the macOS PTY buffer to miss the drain window. We haven't managed to reproduce it locally, but it happens on CI.
Workaround
Mark all 19 tests that spawn real subprocesses via PTY and assert on captured logger output as
xfail(strict=False)on macOS. This unblocks CI while the root cause is investigated.Using
strict=Falsemeans:xpass(no failure)xfail(no failure)Tests marked with
@macos_pty_xfailOutput capture tests:
test_hook_environment_variablestest_real_time_output_loggingtest_post_lease_hook_execution_on_completiontest_exec_bashtest_exec_python3test_script_file_shtest_script_file_py_autodetects_pythontest_script_file_py_exec_overridetest_noninteractive_environmenttest_drain_captures_output_without_trailing_newlineDrain behavior tests (patched PTY):
test_drain_reads_data_remaining_in_pty_buffertest_drain_select_oserror_exits_gracefullytest_drain_select_valueerror_exits_gracefullytest_drain_exits_when_deadline_exceeded_before_selecttest_drain_exception_is_suppressedtest_drain_retries_empty_select_then_captures_datatest_drain_terminates_after_max_empty_pollstest_drain_empty_counter_resets_on_dataRegression tests:
test_infrastructure_messages_at_debug_not_infoRelated
Handles #821 (targeted for proper fix in 0.10.0)