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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy