Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions internal/agent/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,18 @@ func TestCollector_HeartbeatFile(t *testing.T) {
dir := t.TempDir()
hbPath := filepath.Join(dir, "metrics-heartbeat.json")

// Use generous intervals so the test is stable under -race on loaded CI
// runners. Each collect() invokes psutil (cpu.Percent, disk/net counters)
// which can take 50-100 ms; the race detector adds further overhead.
c := NewCollector(Config{
Interval: 50 * time.Millisecond,
HeartbeatInterval: 100 * time.Millisecond,
Interval: 200 * time.Millisecond,
HeartbeatInterval: 400 * time.Millisecond,
OutputDir: dir,
JobID: "test-heartbeat",
HeartbeatFilePath: hbPath,
})

ctx, cancel := context.WithTimeout(context.Background(), 400*time.Millisecond)
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
_ = c.Run(ctx)

Expand Down
Loading