mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
test: fix race condition in TestAPI/Delete/OK_with_container_and_subagent (#21982)
Closes https://github.com/coder/internal/issues/1345#event-22592902899
This commit is contained in:
@@ -1477,14 +1477,6 @@ func TestAPI(t *testing.T) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
api := agentcontainers.NewAPI(logger, apiOpts...)
|
|
||||||
|
|
||||||
api.Start()
|
|
||||||
defer api.Close()
|
|
||||||
|
|
||||||
r := chi.NewRouter()
|
|
||||||
r.Mount("/", api.Routes())
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
agentRunningCh chan struct{}
|
agentRunningCh chan struct{}
|
||||||
stopAgentCh chan struct{}
|
stopAgentCh chan struct{}
|
||||||
@@ -1501,6 +1493,14 @@ func TestAPI(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
api := agentcontainers.NewAPI(logger, apiOpts...)
|
||||||
|
|
||||||
|
api.Start()
|
||||||
|
defer api.Close()
|
||||||
|
|
||||||
|
r := chi.NewRouter()
|
||||||
|
r.Mount("/", api.Routes())
|
||||||
|
|
||||||
tickerTrap.MustWait(ctx).MustRelease(ctx)
|
tickerTrap.MustWait(ctx).MustRelease(ctx)
|
||||||
tickerTrap.Close()
|
tickerTrap.Close()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user