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
8 changes: 8 additions & 0 deletions pkg/util/worker_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ func TestWorkerPool_TestMetric(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)

// Use a channel to signal that the first job has started executing.
started := make(chan struct{})

// Block the first job
workerPool.Submit(func() {
close(started)
wg.Wait()
})

// Wait for the first job to actually start running on the worker,
// ensuring the worker is busy before we submit the next job.
<-started

// create an extra job to increment the metric
workerPool.Submit(func() {})
require.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(`
Expand Down
Loading