Skip to content

test(matrix): wait until broker serves requests before returning it - #40

Merged
mmatloka merged 1 commit into
mainfrom
fix/matrix-broker-serving-wait
Nov 13, 2026
Merged

mmatloka merged 1 commit into
mainfrom
fix/matrix-broker-serving-wait

Conversation

@mmatloka

Copy link
Copy Markdown
Contributor

Summary

  • ci on main (after test(webhook): fix envtest cache race behind flaky main CI #39) failed in integration (cp-8.0): TestIntegration_Converge got broker closed the connection immediately during api versions negotiation ... is TLS missing? right after the container was reported ready. The other six cells passed, and the same commit was green on the PR.
  • Cause: container readiness is log-based (Transitioning from RECOVERY to RUNNING for Confluent, Kafka Server started for Apache), and that can fire a moment before the client listener processes requests. Not a TLS issue, and not caused by the testcontainers kafka 0.45.0 bump (build(deps): bump github.com/testcontainers/testcontainers-go/modules/kafka from 0.44.0 to 0.45.0 #35), which only adds opt-in TLS and leaves the wait strategy unchanged.
  • matrix.StartBroker now pings the broker on its host-reachable listener (retry every 250ms, up to 60s) for both families before returning it. If the broker never serves, the container is terminated and the error says so. This covers every integration and e2e test that starts a broker.

Test plan

  • go vet -tags integration / -tags e2e on internal/matrix, internal/kafka/franz
  • CI integration matrix (all 7 cells) green; not run locally because Docker was unavailable

The containers' log-based readiness ("Transitioning from RECOVERY to
RUNNING" / "Kafka Server started") can fire just before the client
listener processes requests. A client connecting in that window has the
connection closed during ApiVersions negotiation, which franz-go reports
as "is TLS missing?". This failed TestIntegration_Converge on the
cp-8.0 cell on main.

StartBroker now pings the broker on its host-reachable listener (up to
60s) for both families before handing it to the test.
@mmatloka
mmatloka merged commit 5b12c59 into main Nov 13, 2026
14 checks passed
@mmatloka
mmatloka deleted the fix/matrix-broker-serving-wait branch November 13, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant