test: await async admission and held write in either order

This commit is contained in:
pingqiu committed 2026-12-01 18:49:39 -08:00
1 parent 6f579730c4
commit 260c95ab8a
1 file changed
+20 -8
@@ -105,20 +105,32 @@ func TestSnapshotOperationIntentAndPublicationCrashBoundaries(t *testing.T) {
<-done
}
}()
var admitted snapshotOperationAdmission
select {
case <-reached:
case a := <-done:
case admitted = <-done:
joined = true
t.Fatalf("admission ended before crash boundary %s: %+v", kind, a)
if admitted.err != nil {
t.Fatalf("admission failed before crash boundary %s: %+v", kind, admitted)
}
// Asynchronous admission may return before the worker reaches
// its filer write. Still require that actual held boundary before
// killing; an accepted answer alone is never a crash witness.
select {
case <-reached:
case <-time.After(30 * time.Second):
t.Fatal("accepted operation did not reach the actual filer boundary")
}
case <-time.After(30 * time.Second):
t.Fatal("snapshot did not reach the actual filer boundary")
}
var admitted snapshotOperationAdmission
select {
case admitted = <-done:
joined = true
case <-time.After(2 * time.Second):
t.Fatal("no asynchronous durable-intent admission before the held write; no kill credited")
if !joined {
select {
case admitted = <-done:
joined = true
case <-time.After(2 * time.Second):
t.Fatal("no asynchronous durable-intent admission before the held write; no kill credited")
}
}
if admitted.err != nil || admitted.answer.ID != requestID || admitted.location == "" || (admitted.answer.State != "accepted" && admitted.answer.State != "running") {
t.Fatalf("durable intent admission required before kill: %+v", admitted)