The three tests of the controller's own module.json (process, claimed seat, addresses), the Dockerfile and Makefile pin test, the build-agent registry test and the manifest-in-use seat test move with their old package, as tests of mesh-sdk's exported API; a moved test is exempt from failing first.
28 lines
1.1 KiB
Go
28 lines
1.1 KiB
Go
//go:build integration
|
|
|
|
package inventory
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
// The manifest the mesh holds carries each file's text (novox/hq ADR 0349 §2): one still naming a template — a
|
|
// build by a builder that predates templates, or a manifest handed over unbuilt — would compose a file with no
|
|
// text, and is refused by name.
|
|
func TestAManifestStillNamingATemplateIsNotRegistered(t *testing.T) {
|
|
inv := ForTest(t)
|
|
m := catalogue.Manifest{Module: "notifier", Version: "1", Resources: []map[string]any{
|
|
{"id": "conf", "type": "file", "path": "/etc/notifier.conf", "template": "files/notifier.conf"}}}
|
|
err := inv.RegisterModule(t.Context(), m, Source{})
|
|
if err == nil || !strings.Contains(err.Error(), "files/notifier.conf") {
|
|
t.Fatalf("a manifest naming a template was registered: %v", err)
|
|
}
|
|
m.Resources[0] = map[string]any{"id": "conf", "type": "file", "path": "/etc/notifier.conf", "content": "x"}
|
|
if err := inv.RegisterModule(t.Context(), m, Source{}); err != nil {
|
|
t.Fatalf("the same manifest with its text was refused: %v", err)
|
|
}
|
|
}
|