Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix one of the causes of IT flakiness: port conflicts between IPv4 an…
…d IPv6 (#1132) The integration tests rare flakiness (~1/16 chance) seems to have multiple causes. This PR fixes one of them - flakiness caused by port conflicts between IPv4 and IPv6. In one of the flaky runs, `QueryAndIngestPipelineTestcase.testWildcardGoesToElastic` panicked while trying to parse results returned from Quesma (Quesma seemingly returned something really incorrect!): ```go resp, bodyBytes := a.RequestToQuesma(ctx, t, "POST", "/unmentioned_index/_search", []byte(`{"query": {"match_all": {}}}`)) var jsonResponse map[string]interface{} if err := json.Unmarshal(bodyBytes, &jsonResponse); err != nil { t.Fatalf("Failed to unmarshal response body: %s", err) } hits, _ := jsonResponse["hits"].(map[string]interface{}) // PANIC HERE ``` Thankfully I collected a tcpdump from this run, which showed something strange: <img width="1667" alt="Request to Quesma, but Kibana responds" src="https://github.com/user-attachments/assets/e7e32cd0-2aa2-4185-8829-ed99e8b334f7" /> Dumping all containers info from Docker: ``` Quesma container: "Ports": { "8080/tcp": [{ "HostIp": "0.0.0.0", "HostPort": "32790" }, { "HostIp": "::", "HostPort": "32789" }], }, Kibana container: "Ports": { "5601/tcp": [{ "HostIp": "0.0.0.0", "HostPort": "32791" }, { "HostIp": "::", "HostPort": "32790" }] }, ``` Quesma container is bound to `0.0.0.0:32790` (IPv4) and Kibana container is bound to `::0:32790` (IPv6). When we make requests to Quesma, we connect to `localhost:32790` - depending on the codepath sometimes it connects to the correct IPv4 Quesma endpoint, but sometimes it uses IPv6 and erroneously connects to Kibana instead. This is a bug in testcontainers-go: testcontainers/testcontainers-go#551 A suggested solution on the linked issue is to bind ports to host only by IPv4 - this PR applies such workaround. Note that there are some other sources of flakiness in Quesma's ITs still left to debug and fix - this only fixes one of them.
- Loading branch information