package buckets import ( "encoding/json" "os" "testing" ) // The engine's own states are named _ by the manifest; a constant that drifts from it reads and writes a // bucket nobody else knows (ADR 0634 ยง1, finding F4: the holder's name is kept in code and held to the manifest by this row). func TestTheOwnStatesAreTheManifestsStates(t *testing.T) { raw, err := os.ReadFile("../../module.json") if err != nil { t.Fatal(err) } var m struct { Module string `json:"module"` State []struct { Name string `json:"name"` } `json:"state"` } if err := json.Unmarshal(raw, &m); err != nil { t.Fatal(err) } declared := map[string]bool{} for _, s := range m.State { declared[m.Module+"_"+s.Name] = true } for name, bucket := range map[string]string{"data": Data, "health": Health} { if !declared[bucket] { t.Errorf("the bucket %s for the state %s is not one the manifest of %s declares (%v)", bucket, name, m.Module, declared) } } }