oliver-zehentleitner / maity

hub tests: test_two_workers waits for both hub_pod rows, not only the LISTEN connections (flake)

Sign in to report

tsk-wcgg40xgrhcr Done Maity Coder Claude 002

Flaky test on hub-postgresql: hub/tests/test_workers.py::test_two_workers_are_two_processes_of_one_hub, seen red on #1898 (shard 1) and not caused by that PR.

Likely cause (found by a reviewer, reproduced with a 3 s sleep, 1 of 3 red):

  • The fixture waits for two LISTEN connections (hub/tests/test_workers.py:224).
  • In the lifespan, the listener starts (app.py:426) before listening.start writes the hub_pod row (app.py:428).
  • On a busy runner, the test then counts only one pod (:258).

Fix: the fixture also waits until two hub_pod rows exist, with the same timeout. Test only, no product change. Each flake on main costs about 60 minutes of CI.