Skip to content

Commit 865eb7b

Browse files
authored
Fix docker gateway ip discovery (#1329)
* check failing test * check some docker nw * return only if gateway ip is set
1 parent 320b40a commit 865eb7b

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

functional_tests/functional_test.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ func deployChartsAndApps(t *testing.T) {
158158
}
159159

160160
require.NoError(t, err)
161+
162+
hostEp := hostEndpoint(t)
163+
if len(hostEp) == 0 {
164+
require.Fail(t, "Host endpoint not found")
165+
}
166+
161167
replacements := struct {
162168
K8sClusterEndpoint string
163169
AgentEndpoint string
@@ -168,13 +174,13 @@ func deployChartsAndApps(t *testing.T) {
168174
LogObjectsHecEndpoint string
169175
KubeTestEnv string
170176
}{
171-
fmt.Sprintf("http://%s:%d", hostEndpoint(t), signalFxReceiverK8sClusterReceiverPort),
172-
fmt.Sprintf("http://%s:%d", hostEndpoint(t), signalFxReceiverPort),
173-
fmt.Sprintf("http://%s:%d", hostEndpoint(t), hecReceiverPort),
174-
fmt.Sprintf("http://%s:%d/services/collector", hostEndpoint(t), hecMetricsReceiverPort),
175-
fmt.Sprintf("%s:%d", hostEndpoint(t), otlpReceiverPort),
176-
fmt.Sprintf("http://%s:%d", hostEndpoint(t), apiPort),
177-
fmt.Sprintf("http://%s:%d/services/collector", hostEndpoint(t), hecLogsObjectsReceiverPort),
177+
fmt.Sprintf("http://%s:%d", hostEp, signalFxReceiverK8sClusterReceiverPort),
178+
fmt.Sprintf("http://%s:%d", hostEp, signalFxReceiverPort),
179+
fmt.Sprintf("http://%s:%d", hostEp, hecReceiverPort),
180+
fmt.Sprintf("http://%s:%d/services/collector", hostEp, hecMetricsReceiverPort),
181+
fmt.Sprintf("%s:%d", hostEp, otlpReceiverPort),
182+
fmt.Sprintf("http://%s:%d", hostEp, apiPort),
183+
fmt.Sprintf("http://%s:%d/services/collector", hostEp, hecLogsObjectsReceiverPort),
178184
kubeTestEnv,
179185
}
180186
tmpl, err := template.New("").Parse(string(valuesBytes))
@@ -1312,7 +1318,9 @@ func hostEndpoint(t *testing.T) string {
13121318
network, err := client.NetworkInspect(ctx, "kind", types.NetworkInspectOptions{})
13131319
require.NoError(t, err)
13141320
for _, ipam := range network.IPAM.Config {
1315-
return ipam.Gateway
1321+
if ipam.Gateway != "" {
1322+
return ipam.Gateway
1323+
}
13161324
}
13171325
require.Fail(t, "failed to find host endpoint")
13181326
return ""

0 commit comments

Comments
 (0)