Files
mesh-controller/cmd/mesh-controller/plans_gone_store_integration_test.go
T

36 lines
1.3 KiB
Go

//go:build integration
package main
import (
"strings"
"testing"
"git.novox.be/novox/mesh-sdk/go/catalogue"
)
// **The controller opens on a store whose plan tables are gone** (novox/hq ADR 0539 §17, issue 1945 B9): migration 0108 has
// dropped the record of sends, the assignment generation, the gate's verdicts and the durations, and the controller still
// assigns a module, reads where it runs, takes it off and reads the nodes.
func TestTheControllerOpensOnAStoreWithoutThePlanTables(t *testing.T) {
open := aMesh(t)
ctx := t.Context()
inv := open.inventory
for _, row := range inv.QueryForTest(t, `select table_name::text from information_schema.tables where table_schema = 'public'`) {
switch name := strings.Trim(row[0], `"`); name {
case "declaration_send", "assignment_generation", "build_gate", "duration":
t.Errorf("the table %s is in the store", name)
}
}
register(t, open, catalogue.Manifest{Module: "notes", Version: "1"})
if _, err := assign(ctx, open, "anchor", "notes"); err != nil {
t.Fatalf("assign on the migrated store: %v", err)
}
if on, err := inv.Assigned(ctx, "anchor"); err != nil || len(on) != 1 || on[0] != "notes" {
t.Fatalf("assigned %v: %v", on, err)
}
if nodes, err := inv.Nodes(ctx); err != nil || len(nodes) == 0 {
t.Fatalf("nodes %v: %v", nodes, err)
}
}