Skip to content

Commit 4ffae11

Browse files
committed
fix
1 parent f8f11eb commit 4ffae11

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

coderd/prometheusmetrics/prometheusmetrics_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func TestAgents(t *testing.T) {
309309
defer cancelFunc()
310310

311311
// when
312-
closeFunc, err := prometheusmetrics.Agents(ctx, slogtest.Make(t, nil), registry, db, &coordinatorPtr, derpMap, agentInactiveDisconnectTimeout, 50*time.Millisecond)
312+
closeFunc, err := prometheusmetrics.Agents(ctx, slogtest.Make(t, nil), registry, db, &coordinatorPtr, derpMap, agentInactiveDisconnectTimeout, time.Millisecond)
313313
require.NoError(t, err)
314314
t.Cleanup(closeFunc)
315315

@@ -413,7 +413,6 @@ func TestAgentStats(t *testing.T) {
413413
// and it doesn't depend on the real time.
414414
closeFunc, err := prometheusmetrics.AgentStats(ctx, slogtest.Make(t, nil), registry, db, time.Now().Add(-time.Minute), time.Millisecond)
415415
require.NoError(t, err)
416-
t.Cleanup(closeFunc)
417416

418417
// then
419418
goldenFile, err := os.ReadFile("testdata/agent-stats.json")
@@ -460,6 +459,8 @@ func TestAgentStats(t *testing.T) {
460459

461460
// Keep this assertion, so that "go test" can print differences instead of "Condition never satisfied"
462461
assert.Equal(t, string(goldenFile), string(out))
462+
463+
closeFunc()
463464
}
464465

465466
func prepareWorkspaceAndAgent(t *testing.T, client *codersdk.Client, user codersdk.CreateFirstUserResponse, workspaceNum int) *agentsdk.Client {

0 commit comments

Comments
 (0)