aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-08-19 14:28:17 -0700
committerCraig Jennings <c@cjennings.net>2026-08-19 14:28:17 -0700
commit4b213a1ed6fc0829c3f74ed4e96f55ffdf4b7b42 (patch)
tree4db2f2ba4424df5497f7166cf44f409ff70c23a1
parent684d0b22e87a2cb685c66a66ce52086262294b34 (diff)
downloadarchsetup-4b213a1ed6fc0829c3f74ed4e96f55ffdf4b7b42.tar.gz
archsetup-4b213a1ed6fc0829c3f74ed4e96f55ffdf4b7b42.zip
fix(test): pin stdin so the net-scenario harness stops hanging
The stubbed ssh is `cat >/dev/null`, which drains stdin to EOF. Without an explicit stdin the stub inherits whatever the test runner had, so it returned instantly when stdin was redirected and blocked forever when it was a terminal or a live pipe. All five tests then hit their 20-second timeout. That made the suite unreliable in the case that matters most, running it by hand. `make test-unit </dev/null` passed while the same target run from a terminal failed, which reads as a flaky test rather than an environment-dependent one.
-rw-r--r--tests/net-scenarios/test_run_net_scenarios.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/net-scenarios/test_run_net_scenarios.py b/tests/net-scenarios/test_run_net_scenarios.py
index 1d92185..a9cd275 100644
--- a/tests/net-scenarios/test_run_net_scenarios.py
+++ b/tests/net-scenarios/test_run_net_scenarios.py
@@ -63,6 +63,12 @@ class RunNetScenarios(unittest.TestCase):
return subprocess.run(
["bash", SCRIPT, "--target", "root@fake-vm"],
capture_output=True, text=True, timeout=20, env=env,
+ # The stubbed ssh is `cat >/dev/null`, which drains stdin to EOF.
+ # Without this the stub inherits whatever stdin the test runner
+ # had, so `make test-unit` passed when stdin was redirected and
+ # hung on all five tests when it was a terminal or a live pipe --
+ # which is how it gets run by hand.
+ stdin=subprocess.DEVNULL,
)
def test_all_checks_pass_exits_zero(self):