source: advance the checked projection

Source-Sha: 194a59adfd6c901635da7a9c18253bb2210e2426
Policy-Sha: b9b0be0ee74e55f561a803b8aef6be3c2134f5a83b46816a069a372f2eb04f4d
Tree-Digest: 4697f2e281c1c6ecafff17cf6eeb391a0a1ac0fa6e5fc429f5b473f4579c252c
This commit is contained in:
Source publisher 2026-09-21 14:39:08 +00:00
commit ffdccba10f
42 changed files with 2516 additions and 554 deletions

View file

@ -26,12 +26,22 @@ func TestGo_RunsAllSubmittedTasks(t *testing.T) {
if got != n {
t.Fatalf("ran %d tasks, want %d", got, n)
}
s := r.Snapshot()
if s.Submitted != n {
if s := r.Snapshot(); s.Submitted != n {
t.Errorf("submitted=%d, want %d", s.Submitted, n)
}
if s.Completed != n {
t.Errorf("completed=%d, want %d", s.Completed, n)
// Completed is incremented after the task body returns, so the WaitGroup
// above cannot cover it: the last worker may still be accounting when Wait
// releases. Wait for the counter actually asserted, as the panic test does.
deadline := time.Now().Add(time.Second)
for time.Now().Before(deadline) {
if r.Snapshot().Completed >= n {
break
}
time.Sleep(2 * time.Millisecond)
}
if c := r.Snapshot().Completed; c != n {
t.Errorf("completed=%d, want %d", c, n)
}
}