mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(agent/agentcontainers): fix TestAPI/NoUpdaterLoopLogspam flake (#18905)
This commit is contained in:
@@ -358,15 +358,22 @@ func TestAPI(t *testing.T) {
|
||||
fakeCLI = &fakeContainerCLI{
|
||||
listErr: firstErr,
|
||||
}
|
||||
fWatcher = newFakeWatcher(t)
|
||||
)
|
||||
|
||||
api := agentcontainers.NewAPI(logger,
|
||||
agentcontainers.WithWatcher(fWatcher),
|
||||
agentcontainers.WithClock(mClock),
|
||||
agentcontainers.WithContainerCLI(fakeCLI),
|
||||
)
|
||||
api.Start()
|
||||
defer api.Close()
|
||||
|
||||
// The watcherLoop writes a log when it is initialized.
|
||||
// We want to ensure this has happened before we start
|
||||
// the test so that it does not intefere.
|
||||
fWatcher.waitNext(ctx)
|
||||
|
||||
// Make sure the ticker function has been registered
|
||||
// before advancing the clock.
|
||||
tickerTrap.MustWait(ctx).MustRelease(ctx)
|
||||
|
||||
Reference in New Issue
Block a user