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
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// A module on the shelf from before ADR 0233, which writes its backup lines by hand and declares no
|
|
// data, is still backed up: its lines are placed as written, each module's under a comment naming it.
|
|
func TestHandWrittenBackupLinesOfAnOlderModuleArePlaced(t *testing.T) {
|
|
pg, err := decodeForTest([]byte(`{"module":"pg","version":"1",
|
|
"resources":[{"id":"dumps","type":"directory","path":"/srv/pg/dumps","mode":"0700"}],
|
|
"contributions":[{"seat":"node-backup","kind":"backup","content":"run pg-dump-all\npath ${dir:dumps}"}]}`))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
mail, err := decodeForTest([]byte(`{"module":"mail","version":"1",
|
|
"resources":[{"id":"spool","type":"directory","mode":"0700"}],
|
|
"contributions":[{"seat":"node-backup","kind":"backup","content":"path ${dir:spool}"}]}`))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
placed, _, err := seatContributions([]Manifest{pg, mail}, Manifest{}, BackupSeat+":"+"backup", Rendering{}, nil, nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, want := range []string{"# pg\nrun pg-dump-all\npath /srv/pg/dumps\n", "# mail\npath /var/lib/mail/spool\n"} {
|
|
if !strings.Contains(placed, want) {
|
|
t.Errorf("placed contributions lack %q:\n%s", want, placed)
|
|
}
|
|
}
|
|
if strings.Contains(placed, "${dir:") {
|
|
t.Errorf("a directory reached the holder unfilled:\n%s", placed)
|
|
}
|
|
}
|