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 b24194f48d9 Make test_cli_run_time tolerant of slow/cold CI runners 
(#68968)
b24194f48d9 is described below

commit b24194f48d991b0b6c892092f07c149cf768a783
Author: Jarek Potiuk <[email protected]>
AuthorDate: Fri Jun 26 14:49:34 2026 -0400

    Make test_cli_run_time tolerant of slow/cold CI runners (#68968)
    
    The test asserted the best of 3 "airflow --help" startup samples was under a
    tight 5s bound. On a loaded or cold runner (e.g. the Pendulum2 special-test 
job,
    which runs in a freshly rebuilt env) the whole-provider-load startup 
consistently
    sits just over it -- the best of 3 was 5.49s -- even though nothing 
regressed.
    
    Take the min of more samples and loosen the threshold so the test still 
guards
    against gross startup regressions without flaking on small fluctuations.
---
 airflow-core/tests/unit/cli/test_cli_parser.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/airflow-core/tests/unit/cli/test_cli_parser.py 
b/airflow-core/tests/unit/cli/test_cli_parser.py
index c4d8a95f008..acba2fa5d2e 100644
--- a/airflow-core/tests/unit/cli/test_cli_parser.py
+++ b/airflow-core/tests/unit/cli/test_cli_parser.py
@@ -629,12 +629,14 @@ class TestCliSubprocess:
 
         # Warm-up run
         subprocess.run(command, env=env, capture_output=True, check=False)
-        # Limit the number of samples otherwise the test will take a very long 
time
-        num_samples = 3
-        threshold = 5
+        # Take the min across several samples to measure best-case startup and 
tolerate transient CI
+        # slowness; keep the count bounded so the test does not take a very 
long time. The threshold is
+        # deliberately loose -- this guards against gross startup regressions, 
not small fluctuations,
+        # and a tight bound flakes on loaded/cold runners (e.g. the Pendulum2 
special-test job).
+        num_samples = 5
+        threshold = 8
         raw_times = timeit.repeat(stmt=timing_code, setup=setup_code, 
number=1, repeat=num_samples)
         timing_result = min(raw_times)
-        # Minimum run time of Airflow CLI should at least be within 5s
         assert timing_result < threshold
 
     def test_airflow_config_contains_providers(self):

Reply via email to