Make tests that wait for concurrent work wait on the event or a condition with a long deadline (issue 1814)
A test that slept a fixed time and then asserted what a goroutine, process or watcher did failed under the checker's load. Each now waits for its positive evidence (a started baseline, a call counted, a state reached) within 30 s, and the concurrency-limit tests meet at a barrier instead of overlapping by sleep. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
This commit is contained in:
@@ -252,7 +252,7 @@ func TestRunRepairsWhenNudged(t *testing.T) {
|
||||
c, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
go w.g.Run(c)
|
||||
deadline := time.Now().Add(5 * time.Second)
|
||||
deadline := time.Now().Add(30 * time.Second)
|
||||
for w.g.State() != AdminOK {
|
||||
if time.Now().After(deadline) {
|
||||
t.Fatal("no first check")
|
||||
|
||||
@@ -108,7 +108,7 @@ func movedWorld(t *testing.T, h *harness.Harness) (f *fakeKeycloak, start func()
|
||||
Offers: map[string]provider.Offer{ProvisionName: {Credential: provider.PerConsumer, Serves: servedValues(testIssuer)}},
|
||||
Make: run.Make, Gone: run.Gone, Every: h.Every, Logf: func(string, ...any) {}})
|
||||
return f, func() {
|
||||
runCtx, cancel := context.WithTimeout(ctx, 2*time.Second)
|
||||
runCtx, cancel := context.WithTimeout(ctx, 60*time.Second)
|
||||
t.Cleanup(cancel)
|
||||
go func() { _ = run.Run(runCtx, p, bus) }()
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func TestTheGrantPathLeavesWhenTheConsumersFileIsFilled(t *testing.T) {
|
||||
}
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(2 * time.Second):
|
||||
case <-time.After(30 * time.Second):
|
||||
t.Fatal("did not leave when the file was filled")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user