Skip to content

Commit 599e8ce

Browse files
committed
test(coderd): Close metricscache and avoid background context
1 parent 1d0fae8 commit 599e8ce

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

coderd/coderd.go

+1
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ func New(options *Options) *API {
298298
DeploymentStats: options.AgentStatsRefreshInterval,
299299
},
300300
)
301+
defer metricsCache.Close()
301302

302303
staticHandler := site.Handler(site.FS(), binFS, binHashes)
303304
// Static file handler must be wrapped with HSTS handler if the

coderd/metricscache/metricscache_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ func TestCache_DeploymentStats(t *testing.T) {
435435
cache := metricscache.New(db, slogtest.Make(t, nil), metricscache.Intervals{
436436
DeploymentStats: testutil.IntervalFast,
437437
})
438+
defer cache.Close()
438439

439440
_, err := db.InsertWorkspaceAgentStat(context.Background(), database.InsertWorkspaceAgentStatParams{
440441
ID: uuid.New(),

coderd/workspaceapps/apptest/setup.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func createWorkspaceWithApps(t *testing.T, client *codersdk.Client, orgID uuid.U
347347
primaryAppHost, err := client.AppHost(appHostCtx)
348348
require.NoError(t, err)
349349
if primaryAppHost.Host != "" {
350-
manifest, err := agentClient.Manifest(context.Background())
350+
manifest, err := agentClient.Manifest(appHostCtx)
351351
require.NoError(t, err)
352352
proxyURL := fmt.Sprintf(
353353
"http://{{port}}--%s--%s--%s%s",

0 commit comments

Comments
 (0)