This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 50065c3ac94 Fix flaky OpenShell background-child wrapper test (#75823)
50065c3ac94 is described below

commit 50065c3ac944841ea8a47a5a10b1361bb9ef2a21
Author: Shahar Epstein <[email protected]>
AuthorDate: Wed Oct 28 05:11:46 2026 +0200

    Fix flaky OpenShell background-child wrapper test (#75823)
    
    The wrapper returns as soon as the command's shell exits, which can be
    before the shell's forked background child has exec'd sleep. A single
    /proc scan right after the call then finds no "sleep 304" process on a
    loaded runner, so the test failed with `assert []` although the child
    was running.
---
 .../common/ai/tests/unit/common/ai/sandbox/test_openshell.py     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/providers/common/ai/tests/unit/common/ai/sandbox/test_openshell.py 
b/providers/common/ai/tests/unit/common/ai/sandbox/test_openshell.py
index 9dd4e6c8917..a806f8f834d 100644
--- a/providers/common/ai/tests/unit/common/ai/sandbox/test_openshell.py
+++ b/providers/common/ai/tests/unit/common/ai/sandbox/test_openshell.py
@@ -1377,12 +1377,17 @@ class TestRunWrapper:
     def test_a_background_child_does_not_hold_the_call(self):
         started = time.monotonic()
         result = self._run("sleep 304 & echo started", seconds=30)
+        elapsed = time.monotonic() - started
 
-        survivors = self._pids("sleep 304")
+        # The forked child may not have exec'd sleep yet when the wrapper 
returns.
+        for _ in range(100):
+            if survivors := self._pids("sleep 304"):
+                break
+            time.sleep(0.05)
         for pid in survivors:
             os.kill(pid, signal.SIGKILL)
         assert (result.returncode, result.stdout) == (0, b"started\n")
-        assert time.monotonic() - started < 5
+        assert elapsed < 5
         assert survivors
 
     def test_a_failure_to_stage_the_command_has_its_own_status(self, tmp_path):

Reply via email to