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:
Mathias Fredriksson
2022-11-09 15:31:24 +02:00
committed by GitHub
parent 8cadb33396
commit 26ab0d37c1
25 changed files with 82 additions and 64 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ func TestSpeedtest(t *testing.T) {
}
client, workspace, agentToken := setupWorkspaceForAgent(t)
agentClient := codersdk.New(client.URL)
agentClient.SessionToken = agentToken
agentClient.SetSessionToken(agentToken)
agentCloser := agent.New(agent.Options{
Client: agentClient,
Logger: slogtest.Make(t, nil).Named("agent"),