Wait for the done key's grant, which the take-in writes after the compositions (issue 1945)

This commit is contained in:
2026-10-24 23:45:33 +02:00
parent e338b1f0f4
commit 0af12b369b
@@ -431,9 +431,12 @@ func TestServedADoneKeyIsComposedAndGranted(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
gk, _ := sdkdelivery.ControllerGrantKey("board", fp) gk, _ := sdkdelivery.ControllerGrantKey("board", fp)
if _, err := grants.Get(ctx, gk); err != nil { // The take-in writes the grant after the compositions (composed_keys.go), so it is waited for, not read in the instant
t.Errorf("grants.%s is not written: %v", gk, err) // the composition shows: a loaded build node read it a moment early (issue 1945).
} becomes(t, 10*time.Second, "grants."+gk+" written", func() bool {
_, err := grants.Get(ctx, gk)
return err == nil
})
if n := m.declarationsSent(t); n != 0 { if n := m.declarationsSent(t); n != 0 {
t.Errorf("%d declarations were sent", n) t.Errorf("%d declarations were sent", n)
} }