MCPcopy Index your code
hub / github.com/coder/coder / TestStatsCollector_Close

Function TestStatsCollector_Close

coderd/workspaceapps/stats_test.go:404–425  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

402}
403
404func TestStatsCollector_Close(t *testing.T) {
405 t.Parallel()
406
407 reporter := &fakeReporter{}
408 collector := workspaceapps.NewStatsCollector(workspaceapps.StatsCollectorOptions{
409 Reporter: reporter,
410 ReportInterval: time.Hour,
411 RollupWindow: time.Minute,
412 })
413
414 collector.Collect(workspaceapps.StatsReport{
415 SessionID: uuid.New(),
416 SessionStartedAt: dbtime.Now(),
417 SessionEndedAt: dbtime.Now(),
418 Requests: 1,
419 })
420
421 collector.Close()
422
423 // Verify that stats are reported after close.
424 assert.NotEmpty(t, reporter.stats())
425}

Callers

nothing calls this directly

Calls 7

CollectMethod · 0.95
CloseMethod · 0.95
statsMethod · 0.95
NewStatsCollectorFunction · 0.92
NowFunction · 0.92
NotEmptyMethod · 0.80
NewMethod · 0.65

Tested by

no test coverage detected