Skip to content

Commit 271e4c2

Browse files
fix(agent/agentcontainers): fix TestAPI/NoUpdaterLoopLogspam flake
1 parent b4c9725 commit 271e4c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

agent/agentcontainers/api_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,22 @@ func TestAPI(t *testing.T) {
358358
fakeCLI = &fakeContainerCLI{
359359
listErr: firstErr,
360360
}
361+
fWatcher = newFakeWatcher(t)
361362
)
362363

363364
api := agentcontainers.NewAPI(logger,
365+
agentcontainers.WithWatcher(fWatcher),
364366
agentcontainers.WithClock(mClock),
365367
agentcontainers.WithContainerCLI(fakeCLI),
366368
)
367369
api.Start()
368370
defer api.Close()
369371

372+
// Wait for the watcher to have initialized. As the
373+
// watcher logs, it can interfere with the test and
374+
// cause a flake.
375+
testutil.RequireReceive(ctx, t, fWatcher.nextCalled)
376+
370377
// Make sure the ticker function has been registered
371378
// before advancing the clock.
372379
tickerTrap.MustWait(ctx).MustRelease(ctx)

0 commit comments

Comments
 (0)