Issue 1585, S19: the strict parser, every manifest problem function and the judge's tables (192 declarations, about 5,200 lines) and their 244 tests leave; composition keeps its own refusals and the helpers it uses. The catalogue's tests decode the manifests they build. ParseManifest, ParseManifestWith, ParseManifestForInputs, CatalogueProblems and the rest are gone; mesh-delivery-indexer/judge holds them. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/internal/beside"
|
|
)
|
|
|
|
// The catalogue's bus protects its streams by the snapshot, not as live files: its streams' item is a
|
|
// dump into its snapshots, it has the account the dump runs as, and the dump runs the snapshot
|
|
// program in the bus's own container.
|
|
func TestTheCataloguesBusIsBackedUpBySnapshot(t *testing.T) {
|
|
raw, err := os.ReadFile(filepath.Join(beside.Catalogue(t), "nats", "module.json"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
m, err := decodeForTest(raw)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, account := m.OwnSecrets["broker"]; !account {
|
|
t.Fatal("the bus declares no account, so its snapshot could not reach it")
|
|
}
|
|
var found bool
|
|
if m.Data == nil {
|
|
t.Fatal("the bus declares no data")
|
|
}
|
|
for _, it := range m.Data.Own {
|
|
if it.ID != "jetstream" {
|
|
continue
|
|
}
|
|
found = true
|
|
if !it.Backup.IsDump() || it.Backup.Into != "snapshots" {
|
|
t.Fatalf("the bus's streams are protected by %+v, not a snapshot into its snapshots", it.Backup)
|
|
}
|
|
if !strings.Contains(it.Backup.Dump, "mesh-nats-snapshot snapshot") {
|
|
t.Fatalf("the dump does not run the snapshot program: %s", it.Backup.Dump)
|
|
}
|
|
}
|
|
if !found {
|
|
t.Fatal("the bus declares no item for its streams")
|
|
}
|
|
}
|