Say the credential's state and what composing the consumer gives when the served rotation test fails (issue 1945)

This commit is contained in:
2026-10-24 20:09:22 +02:00
parent b879128efb
commit 8fab4d8b22
@@ -451,8 +451,23 @@ func TestServedARotationRewritesOnlyTheCompositionsThatUseIt(t *testing.T) {
// The board's sealed credential file is new: its composition moves with the rotation.
if rev := m.waitForOrSay(t, "laptop", boardKey, before["laptop"][boardKey]); rev == 0 {
after, _ := m.open.inventory.HoldersOf(t.Context(), "postgres-database", "")
t.Fatalf("the board's composition did not move within a minute after the rotation; holders before %+v, after %+v; rotate said: %s; %s",
holders, after, strings.Join(strings.Fields(strings.ReplaceAll(said, "\n", " | ")), " "), m.whatIsThere(t, "laptop"))
in, ierr := inputFor(t.Context(), m.open)
var credentials string
if ierr == nil {
credentials = fmt.Sprintf("would make %+v; credentials %+v", in.wouldMake, in.Credentials)
}
state, serr := m.open.inventory.PairCredentialState(t.Context(), inventory.PairCredential{Name: "postgres-database",
Consumer: "laptop", ConsumerModule: "board", Provider: "anchor"})
d, derr := composeSend(t.Context(), m.open, "laptop")
var sealed []string
for _, r := range d.Resources {
if r["id"] == "board.secret-postgres-database" {
sealed = append(sealed, fmt.Sprint(r["sealed"])[:min(24, len(fmt.Sprint(r["sealed"])))])
}
}
diag := fmt.Sprintf("state %+v %v; compose now %v sealed %v; %s %v", state, serr, derr, sealed, credentials, ierr)
t.Fatalf("the board's composition did not move within a minute after the rotation; holders before %+v, after %+v; DIAG %s; rotate said: %s; %s",
holders, after, diag, strings.Join(strings.Fields(strings.ReplaceAll(said, "\n", " | ")), " "), m.whatIsThere(t, "laptop"))
}
moved := map[string]bool{}
for node, was := range before {