This repository was archived by the owner on Nov 7, 2025. It is now read-only.
Commit cb7b0cf
authored
Fix one of the causes of IT flakiness: port conflicts between IPv4 and 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.1 parent 38f12b0 commit cb7b0cf
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
0 commit comments