Skip to content

Commit eccc38f

Browse files
committed
remove internet based request
1 parent b42ea1e commit eccc38f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

coderd/coderdtest/oidctest/idp.go

+4
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ func (f *FakeIDP) WellknownConfig() ProviderJSON {
223223
return f.provider
224224
}
225225

226+
func (f *FakeIDP) IssuerURL() *url.URL {
227+
return f.issuerURL
228+
}
229+
226230
func (f *FakeIDP) updateIssuerURL(t testing.TB, issuer string) {
227231
t.Helper()
228232

coderd/promoauth/oauth2_test.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,20 @@ func TestMaintainDefault(t *testing.T) {
4747
// Verify the default client was not broken. This check is added because we
4848
// extend the http.DefaultTransport. If a `.Clone()` is not done, this can be
4949
// mis-used. It is cheap to run this quick check.
50-
_, err = http.DefaultClient.Get("https://coder.com")
50+
req, err := http.NewRequest(http.MethodGet,
51+
must(idp.IssuerURL().Parse("/.well-known/openid-configuration")).String(), nil)
5152
require.NoError(t, err)
53+
54+
resp, err := http.DefaultClient.Do(req)
55+
require.NoError(t, err)
56+
_ = resp.Body.Close()
57+
5258
require.Equal(t, count(), 2)
5359
}
60+
61+
func must[V any](v V, err error) V {
62+
if err != nil {
63+
panic(err)
64+
}
65+
return v
66+
}

0 commit comments

Comments
 (0)