package host import ( "context" "github.com/carlosframework/platform/internal/release" "testing" ) func TestPlan14RootHistoryMintUsesRootInventory(t *testing.T) { if !plan14RootFixture(t) { return } if legacy, err := legacyRootRestart(); err != nil || !legacy { t.Fatalf("expected a box without a census: legacy=%v error=%v", legacy, err) } e, _, _, _ := plan14ProofFixture(t) h := &release.RootHistory{Store: &rollbackMemory{files: map[string][]byte{}}} e.root.refusals = h.MintRefusals e.root.mintCensus = func() (bool, error) { legacy, err := legacyRootRestart() return !legacy && err == nil, err } for pass := 1; pass <= 2; pass++ { e.root.run(context.Background()) if e.proof(t) != nil { t.Fatal("minted without a census") } pauses := 0 for _, line := range e.logs { if line == "proof: minting paused until this box has a root census" { pauses++ } } if pauses != pass { t.Fatalf("pause logged %d times after %d passes: %v", pauses, pass, e.logs) } } if len(release.ReadHealthy(e.root.historyDir(), "bab", "console")) != 1 { t.Fatal("mint pause suppressed health") } }