Skip to content

Commit 8dfc261

Browse files
committed
Fix coordination test
1 parent d5555f6 commit 8dfc261

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

coderd/coderd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,10 @@ func (api *API) Close() error {
558558
api.websocketWaitMutex.Unlock()
559559

560560
api.metricsCache.Close()
561-
561+
coordinator := api.TailnetCoordinator.Load()
562+
if coordinator != nil {
563+
_ = (*coordinator).Close()
564+
}
562565
return api.workspaceAgentCache.Close()
563566
}
564567

enterprise/coderd/workspaceagents_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ func setupWorkspaceAgent(t *testing.T, client *codersdk.Client, user codersdk.Cr
8989
CoordinatorDialer: agentClient.ListenWorkspaceAgentTailnet,
9090
Logger: slogtest.Make(t, nil).Named("agent"),
9191
})
92-
defer func() {
92+
t.Cleanup(func() {
9393
_ = agentCloser.Close()
94-
}()
94+
})
9595
resources := coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
9696
return resources[0].Agents[0].ID
9797
}

0 commit comments

Comments
 (0)