Take the bus's backup guard out of modules/nats: it would move the bus (issue 1098, guard follows in issue 1104)
mesh/repo-check head 3bc4215d872c merged into trunk 44e7002d3c84 beside mesh-controller#378@0149a3d7 — pass: its merge-check.sh passed, each part in its to…
mesh/delivery stopped: its walk plan-1792289060772890935 was stopped by a person (mesh-controller): the operator, via telegram (user id verified), chose …
mesh/delivery-group group feat/chain-on-the-bus stopped: a member was stopped
mesh/merge-gate out of date: judged against trunk 798d6fd68589, the trunk is now e40ec47058e6; judged again on a recheck or when it is merged
mesh/repo-check head 3bc4215d872c merged into trunk 44e7002d3c84 beside mesh-controller#378@0149a3d7 — pass: its merge-check.sh passed, each part in its to…
mesh/delivery stopped: its walk plan-1792289060772890935 was stopped by a person (mesh-controller): the operator, via telegram (user id verified), chose …
mesh/delivery-group group feat/chain-on-the-bus stopped: a member was stopped
mesh/merge-gate out of date: judged against trunk 798d6fd68589, the trunk is now e40ec47058e6; judged again on a recheck or when it is merged
This commit is contained in:
@@ -1,72 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
// The bus's storage stays declared as data protected by a backup (novox/hq ADR 0408 clause 7; issue 1098): the
|
|
||||||
// assignments, rollouts and builds now live in the bus's buckets, so a manifest that stopped saying so would leave
|
|
||||||
// the one copy of them unprotected. The storage directory is declared as valuable data with a dump into the
|
|
||||||
// snapshots directory, which is itself declared.
|
|
||||||
func TestTheBusStorageIsDeclaredAsDataProtectedByABackup(t *testing.T) {
|
|
||||||
raw, err := os.ReadFile("../../module.json")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
var m struct {
|
|
||||||
Data struct {
|
|
||||||
Own []struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Class string `json:"class"`
|
|
||||||
Backup *struct {
|
|
||||||
Dump string `json:"dump"`
|
|
||||||
Into string `json:"into"`
|
|
||||||
} `json:"backup"`
|
|
||||||
} `json:"own"`
|
|
||||||
} `json:"data"`
|
|
||||||
Resources []struct {
|
|
||||||
ID string `json:"id"`
|
|
||||||
Type string `json:"type"`
|
|
||||||
} `json:"resources"`
|
|
||||||
}
|
|
||||||
if err := json.Unmarshal(raw, &m); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
var storage, snapshots bool
|
|
||||||
for _, d := range m.Data.Own {
|
|
||||||
switch d.ID {
|
|
||||||
case "jetstream":
|
|
||||||
if d.Path != "${dir:jetstream-data}" || d.Class != "valuable" {
|
|
||||||
t.Errorf("the bus's storage is declared as %q, class %q", d.Path, d.Class)
|
|
||||||
}
|
|
||||||
if d.Backup == nil || strings.TrimSpace(d.Backup.Dump) == "" || d.Backup.Into != "snapshots" {
|
|
||||||
t.Errorf("the bus's storage has no dump into the snapshots: %+v", d.Backup)
|
|
||||||
}
|
|
||||||
storage = true
|
|
||||||
case "snapshots":
|
|
||||||
snapshots = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !storage || !snapshots {
|
|
||||||
t.Errorf("the bus's storage declared: %v, and its snapshots: %v", storage, snapshots)
|
|
||||||
}
|
|
||||||
var dirs []string
|
|
||||||
for _, r := range m.Resources {
|
|
||||||
if r.Type == "directory" {
|
|
||||||
dirs = append(dirs, r.ID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, want := range []string{"jetstream-data", "snapshots"} {
|
|
||||||
found := false
|
|
||||||
for _, id := range dirs {
|
|
||||||
found = found || id == want
|
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
t.Errorf("the directory %s is not a declared resource (directories: %v)", want, dirs)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user