Say the serving controller's lines on the credential while the served rotation lands (issue 1945)

This commit is contained in:
2026-10-24 20:14:30 +02:00
parent 8fab4d8b22
commit 6ed5de186d
@@ -436,7 +436,16 @@ func TestServedARotationRewritesOnlyTheCompositionsThatUseIt(t *testing.T) {
m := aServedMesh(t)
before := map[string]map[string]uint64{"anchor": m.revisions(t, "anchor"), "laptop": m.revisions(t, "laptop")}
holders, _ := m.open.inventory.HoldersOf(t.Context(), "postgres-database", "")
said, err := capturedOutput(func() error { return rotateCommand(t.Context(), []string{"postgres-database"}) })
var waited uint64
said, err := capturedOutput(func() error {
if err := rotateCommand(t.Context(), []string{"postgres-database"}); err != nil {
return err
}
// The serving controller's own lines while the rotation lands are captured too.
boardKey, _ := sdkdelivery.ComposedKey("laptop", "board", fpOf('b'))
waited = m.waitForOrSay(t, "laptop", boardKey, before["laptop"][boardKey])
return nil
})
if err != nil {
t.Fatalf("rotate: %v\n%s", err, said)
}
@@ -449,7 +458,17 @@ func TestServedARotationRewritesOnlyTheCompositionsThatUseIt(t *testing.T) {
boardKey, _ := sdkdelivery.ComposedKey("laptop", "board", fpOf('b'))
storeKey, _ := sdkdelivery.ComposedKey("anchor", "store", fpOf('a'))
// 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 {
if rev := waited; rev == 0 {
var kept []string
for _, line := range strings.Split(said, "\n") {
for _, w := range []string{"board", "postgres", "secret", "credential", "laptop", "withdr", "retir", "error", "refused"} {
if strings.Contains(line, w) {
kept = append(kept, line)
break
}
}
}
said = strings.Join(kept, " | ")
after, _ := m.open.inventory.HoldersOf(t.Context(), "postgres-database", "")
in, ierr := inputFor(t.Context(), m.open)
var credentials string
@@ -466,8 +485,8 @@ func TestServedARotationRewritesOnlyTheCompositionsThatUseIt(t *testing.T) {
}
}
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"))
t.Fatalf("the board's composition did not move within a minute after the rotation; LINES %s; holders before %+v, after %+v; DIAG %s; %s",
strings.Join(strings.Fields(said), " "), holders, after, diag, m.whatIsThere(t, "laptop"))
}
moved := map[string]bool{}
for node, was := range before {