mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix: Protect codersdk.Client SessionToken so it can be updated (#4965)
This feature is used by the coder agent to exchange a new token. By protecting the SessionToken via mutex we ensure there are no data races when accessing it.
This commit is contained in:
committed by
GitHub
parent
8cadb33396
commit
26ab0d37c1
@ -36,7 +36,7 @@ func TestReplicas(t *testing.T) {
|
||||
Pubsub: pubsub,
|
||||
},
|
||||
})
|
||||
secondClient.SessionToken = firstClient.SessionToken
|
||||
secondClient.SetSessionToken(firstClient.SessionToken())
|
||||
ents, err := secondClient.Entitlements(context.Background())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, ents.Errors, 1)
|
||||
@ -67,7 +67,7 @@ func TestReplicas(t *testing.T) {
|
||||
Pubsub: pubsub,
|
||||
},
|
||||
})
|
||||
secondClient.SessionToken = firstClient.SessionToken
|
||||
secondClient.SetSessionToken(firstClient.SessionToken())
|
||||
replicas, err := secondClient.Replicas(context.Background())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, replicas, 2)
|
||||
@ -110,7 +110,7 @@ func TestReplicas(t *testing.T) {
|
||||
TLSCertificates: certificates,
|
||||
},
|
||||
})
|
||||
secondClient.SessionToken = firstClient.SessionToken
|
||||
secondClient.SetSessionToken(firstClient.SessionToken())
|
||||
replicas, err := secondClient.Replicas(context.Background())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, replicas, 2)
|
||||
|
Reference in New Issue
Block a user