diff --git a/modules/mesh-delivery-view/manifest_test.go b/modules/mesh-delivery-view/manifest_test.go index 13f83cc..68d69f5 100644 --- a/modules/mesh-delivery-view/manifest_test.go +++ b/modules/mesh-delivery-view/manifest_test.go @@ -14,7 +14,9 @@ import ( // repository, which this module cannot import. These tests therefore decode the manifest strictly into the fields the // controller's Manifest, Build and Artifact types name (internal/catalogue/manifest.go:475, :602, :659, :667, :737, // :809, :821, :892, :1010, :1065-:1090), as its parseManifest does (DisallowUnknownFields, manifest.go:1744), and check -// the rules the issue names. +// the rules the issue names, and two rules of the controller's module check (a module with templates packs a files +// archive; a module contributing an item is moved). **The merge gate's module check is what proves the controller +// takes this manifest (1134/AC7); these tests hold the rules so a unit run catches a refusal early.** type artifact struct { Name string `json:"name"` @@ -35,6 +37,7 @@ type item struct { type manifest struct { Module string `json:"module"` + Moved bool `json:"moved"` Version string `json:"version"` Slug string `json:"slug"` Reads []string `json:"reads"` @@ -92,10 +95,13 @@ func TestManifestIsTakenAndReadsOnly(t *testing.T) { // 1134/AC7 func TestManifestIsWholeInItsRepository(t *testing.T) { // 1134/AC7 m, _ := load(t) - if len(m.Build.Artifacts) != 2 { + if len(m.Build.Artifacts) != 3 { t.Fatalf("artifacts = %+v", m.Build.Artifacts) } for _, a := range m.Build.Artifacts { + if a.Name == "files" { + continue + } if a.Context != nil { t.Errorf("artifact %s names a context of another repository", a.Name) } @@ -162,6 +168,20 @@ func TestManifestResources(t *testing.T) { // 1134/AC7 } } +func TestModuleCheckRules(t *testing.T) { // 1134/AC7 + m, _ := load(t) + if len(m.Items) > 0 && !m.Moved { + t.Error("a module contributing an item is marked moved: true") + } + var files bool + for _, a := range m.Build.Artifacts { + files = files || (a.Name == "files" && a.Kind == "archive" && a.From == "files") + } + if len(m.Items) > 0 && !files { + t.Error("a module naming templates packs a files archive from files/") + } +} + func TestAliasItem(t *testing.T) { // 1137/AC1 m, _ := load(t) if !reflect.DeepEqual(m.Items, []item{{Collection: "shell:zsh:normal", Template: "files/zsh-normal"}}) { diff --git a/modules/mesh-delivery-view/module.json b/modules/mesh-delivery-view/module.json index c74f080..8d144fe 100644 --- a/modules/mesh-delivery-view/module.json +++ b/modules/mesh-delivery-view/module.json @@ -1,6 +1,7 @@ { "module": "mesh-delivery-view", "version": "1", + "moved": true, "slug": "view", "reads": [ "mesh-controller.assignments", @@ -82,6 +83,11 @@ "system": "arch", "from": "cmd/mesh-delivery-cli", "binary": "mesh-delivery-cli" + }, + { + "name": "files", + "kind": "archive", + "from": "files" } ] }