We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7732ac4 commit eac155aCopy full SHA for eac155a
cli/server.go
@@ -1206,6 +1206,14 @@ func WriteConfigMW(cfg *codersdk.DeploymentValues) clibase.MiddlewareFunc {
1206
// isLocalURL returns true if the hostname of the provided URL appears to
1207
// resolve to a loopback address.
1208
func IsLocalURL(ctx context.Context, u *url.URL) (bool, error) {
1209
+ // In tests, we commonly use "example.com" or "google.com", which
1210
+ // are not loopback, so avoid the DNS lookup to avoid flakes.
1211
+ if flag.Lookup("test.v") != nil {
1212
+ if u.Hostname() == "example.com" || u.Hostname() == "google.com" {
1213
+ return false, nil
1214
+ }
1215
1216
+
1217
resolver := &net.Resolver{}
1218
ips, err := resolver.LookupIPAddr(ctx, u.Hostname())
1219
if err != nil {
0 commit comments