Skip to content

Commit 5ed2303

Browse files
committed
chore: change curl target to cloudflare
to workaround a weird issue we are seeing with google dns and vlab external testing Signed-off-by: Emanuele Di Pascale <[email protected]>
1 parent 3c4e2f5 commit 5ed2303

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/hhfab/testing.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ func (c *Config) TestConnectivity(ctx context.Context, vlab *VLAB, opts TestConn
11631163
}
11641164
client := clientR.(*goph.Client)
11651165

1166-
if err := checkCurl(ctx, opts, curls, serverA, client, "8.8.8.8", reachable); err != nil {
1166+
if err := checkCurl(ctx, opts, curls, serverA, client, "1.0.0.1", reachable); err != nil {
11671167
return fmt.Errorf("checking curl from %q: %w", serverA, err)
11681168
}
11691169

@@ -1464,21 +1464,21 @@ func checkCurl(ctx context.Context, opts TestConnectivityOpts, curls *semaphore.
14641464
slog.Debug("Running curls", "from", from, "to", toIP, "count", opts.CurlsCount)
14651465

14661466
for idx := 0; idx < opts.CurlsCount; idx++ {
1467-
cmd := fmt.Sprintf("timeout -v 5 curl --insecure --connect-timeout 3 --silent https://%s", toIP)
1467+
cmd := fmt.Sprintf("timeout -v 5 curl --insecure --connect-timeout 3 --silent http://%s", toIP)
14681468
outR, err := retrySSHCmd(ctx, fromSSH, cmd, from)
14691469
out := strings.TrimSpace(string(outR))
14701470

1471-
curlOk := err == nil && strings.Contains(out, "302 Moved")
1472-
curlFail := err != nil && !strings.Contains(out, "302 Moved")
1471+
curlOk := err == nil && strings.Contains(out, "301 Moved")
1472+
curlFail := err != nil && !strings.Contains(out, "301 Moved")
14731473

14741474
slog.Debug("Curl result", "from", from, "to", toIP, "expected", expected, "ok", curlOk, "fail", curlFail, "err", err, "out", out)
14751475

14761476
if curlOk == curlFail {
14771477
if err != nil {
1478-
return fmt.Errorf("running curl: %w: %s", err, out) // TODO replace with custom error?
1478+
return fmt.Errorf("running curl (expected %t): %w: %s", expected, err, out) // TODO replace with custom error?
14791479
}
14801480

1481-
return fmt.Errorf("unexpected curl result: %s", out)
1481+
return fmt.Errorf("unexpected curl result (expected %t): %s", expected, out)
14821482
}
14831483

14841484
if expected && !curlOk {

0 commit comments

Comments
 (0)