Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9d79cd1

Browse files
committed
Fix a racy context
And rename another, it is not being used incorrectly, but the name makesit clear.
1 parentcbefdb2 commit9d79cd1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎enterprise/coderd/oauth2_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestOAuth2ProviderApps(t *testing.T) {
3939
},
4040
}})
4141

42-
ctx:=testutil.Context(t,testutil.WaitLong)
42+
topCtx:=testutil.Context(t,testutil.WaitLong)
4343

4444
tests:= []struct {
4545
namestring
@@ -142,7 +142,7 @@ func TestOAuth2ProviderApps(t *testing.T) {
142142
CallbackURL:"http://coder.com",
143143
}
144144
//nolint:gocritic // OAauth2 app management requires owner permission.
145-
_,err:=client.PostOAuth2ProviderApp(ctx,req)
145+
_,err:=client.PostOAuth2ProviderApp(topCtx,req)
146146
require.NoError(t,err)
147147

148148
// Generate an application for testing PUTs.
@@ -151,13 +151,14 @@ func TestOAuth2ProviderApps(t *testing.T) {
151151
CallbackURL:"http://coder.com",
152152
}
153153
//nolint:gocritic // OAauth2 app management requires owner permission.
154-
existingApp,err:=client.PostOAuth2ProviderApp(ctx,req)
154+
existingApp,err:=client.PostOAuth2ProviderApp(topCtx,req)
155155
require.NoError(t,err)
156156

157157
for_,test:=rangetests {
158158
test:=test
159159
t.Run(test.name,func(t*testing.T) {
160160
t.Parallel()
161+
ctx:=testutil.Context(t,testutil.WaitLong)
161162

162163
//nolint:gocritic // OAauth2 app management requires owner permission.
163164
_,err:=client.PostOAuth2ProviderApp(ctx,test.req)
@@ -392,11 +393,11 @@ func TestOAuth2ProviderTokenExchange(t *testing.T) {
392393
},
393394
},
394395
})
395-
ctx:=testutil.Context(t,testutil.WaitLong)
396-
apps:=generateApps(ctx,t,ownerClient,"token-exchange")
396+
topCtx:=testutil.Context(t,testutil.WaitLong)
397+
apps:=generateApps(topCtx,t,ownerClient,"token-exchange")
397398

398399
//nolint:gocritic // OAauth2 app management requires owner permission.
399-
secret,err:=ownerClient.PostOAuth2ProviderAppSecret(ctx,apps.Default.ID)
400+
secret,err:=ownerClient.PostOAuth2ProviderAppSecret(topCtx,apps.Default.ID)
400401
require.NoError(t,err)
401402

402403
// The typical oauth2 flow from this point is:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp