Problem
The session fixture's readiness check (tests/conftest.py, wait_for_icap_service) polls until a single OPTIONS request succeeds. c-icap answers OPTIONS while clamd is still loading its signature database, so the first real scans stall, the accept queue backs up, and concurrent tests fail on connect timeouts.
Observed: on a freshly started Docker daemon, test_concurrent_varied_sizes failed 10/10 operations with 'Connection to localhost:1344 timed out', then passed in isolation and in a full rerun once the container was warm.
The three tests currently skipped in CI are plausibly the same root cause (connections desyncing against a not-fully-ready server):
tests/test_connection_robustness.py:56 (test_connection_reuse_after_virus)
tests/test_connection_robustness.py:307 (test_alternating_clean_and_virus)
tests/test_benchmarks.py:169 (test_benchmark_connection_reuse)
Proposed fix
- Extend
wait_for_icap_service to require, after OPTIONS succeeds, 1-2 consecutive successful scan_bytes calls (a clean payload and/or EICAR) with a modest latency bound, so readiness means 'ClamAV is actually scanning', not 'c-icap is accepting connections'.
- Re-enable the three
skipif(CI) tests and observe.
- With flakiness fixed, enable the currently-skipped
integration-tests job in the CI workflow (ubuntu runners have Docker) so the integration suite runs on PRs instead of only locally.
Problem
The session fixture's readiness check (
tests/conftest.py,wait_for_icap_service) polls until a singleOPTIONSrequest succeeds. c-icap answers OPTIONS while clamd is still loading its signature database, so the first real scans stall, the accept queue backs up, and concurrent tests fail on connect timeouts.Observed: on a freshly started Docker daemon,
test_concurrent_varied_sizesfailed 10/10 operations with 'Connection to localhost:1344 timed out', then passed in isolation and in a full rerun once the container was warm.The three tests currently skipped in CI are plausibly the same root cause (connections desyncing against a not-fully-ready server):
tests/test_connection_robustness.py:56(test_connection_reuse_after_virus)tests/test_connection_robustness.py:307(test_alternating_clean_and_virus)tests/test_benchmarks.py:169(test_benchmark_connection_reuse)Proposed fix
wait_for_icap_serviceto require, after OPTIONS succeeds, 1-2 consecutive successfulscan_bytescalls (a clean payload and/or EICAR) with a modest latency bound, so readiness means 'ClamAV is actually scanning', not 'c-icap is accepting connections'.skipif(CI)tests and observe.integration-testsjob in the CI workflow (ubuntu runners have Docker) so the integration suite runs on PRs instead of only locally.