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 65cd588ae89 Fix flaky CloudSQL custom-universe trigger test on loaded
runners (#68981)
65cd588ae89 is described below
commit 65cd588ae89f554015cfb5bda68fcf431172520d
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Jun 25 16:03:08 2026 -0400
Fix flaky CloudSQL custom-universe trigger test on loaded runners (#68981)
The custom-universe branch of CloudSQLExportTrigger.run() fetches the
operation
via sync_to_async(sync_hook.get_operation), which dispatches the call to a
thread-pool executor. The test waited a fixed 0.1s before asserting
get_operation had been called, but on a loaded runner the thread-dispatched
call
can land slightly later, so the assertion intermittently saw it called 0
times.
Poll until the call is observed instead of sleeping a fixed amount. The
trigger's
poke_interval is 10s, so no second call can happen within the poll window
and
assert_called_once stays valid.
---
.../google/tests/unit/google/cloud/triggers/test_cloud_sql.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/providers/google/tests/unit/google/cloud/triggers/test_cloud_sql.py
b/providers/google/tests/unit/google/cloud/triggers/test_cloud_sql.py
index 8787a5cd068..f5de135c47d 100644
--- a/providers/google/tests/unit/google/cloud/triggers/test_cloud_sql.py
+++ b/providers/google/tests/unit/google/cloud/triggers/test_cloud_sql.py
@@ -181,7 +181,14 @@ class TestCloudSQLExportTrigger:
}
task = asyncio.create_task(trigger.run().__anext__())
- await asyncio.sleep(0.1)
+ # The custom-universe branch runs get_operation via sync_to_async,
i.e. in a thread-pool
+ # executor, so the call can land a little later than a fixed short
sleep -- flaky on loaded
+ # runners. Poll until it is observed; poke_interval is 10s, so no
second call happens within
+ # this window and assert_called_once stays valid.
+ for _ in range(100):
+ await asyncio.sleep(0.05)
+ if sync_hook_mock.get_operation.called:
+ break
sync_hook_mock.is_default_universe.assert_called_once()
sync_hook_mock.get_operation.assert_called_once_with(