package store import ( "encoding/json" "os" "testing" ) // **The manifest's placeholder, unfilled, reaches a store reader and changes nothing.** // // The control plane composes its own declaration, so the manifest naming `${seat:…}` can be // composed by a control plane one build older than it — one that passes the literal through as // the value. That is the state of the live control-node between this manifest landing and its // next build being pushed, and a reader that refused the literal would leave it headless // (novox/hq 04-ISSUES/102, finding F1). So the reader is held to ignoring exactly what // module.json says, not a placeholder shaped like it. func TestTheManifestsOwnPlaceholderUnfilledLeavesTheStoreWhereTheFileSays(t *testing.T) { raw, err := os.ReadFile("../../module.json") if err != nil { t.Fatal(err) } var m struct { Resources []struct { Type string `json:"type"` Env map[string]string `json:"env"` } `json:"resources"` } if err := json.Unmarshal(raw, &m); err != nil { t.Fatal(err) } var written string for _, r := range m.Resources { if r.Type == "container" { written = r.Env["MESH_STORE_INVENTORY_PORT"] } } if written == "" { t.Fatal("module.json no longer names MESH_STORE_INVENTORY_PORT") } alone(t) t.Setenv(Variable(example), dsn) t.Setenv(PortVariable(example), written) opened, err := Open(t.Context(), example) if err != nil { t.Fatalf("the unfilled placeholder was refused, which is a headless control plane: %v", err) } defer opened.Close() if got := opened.Pool().Config().ConnConfig.Port; got != 5432 { t.Fatalf("the store is on %d; with the placeholder unfilled, the file's port stands", got) } }