|
|
|
@@ -163,8 +163,8 @@ func TestManifestResources(t *testing.T) { // 1134/AC7
|
|
|
|
|
t.Errorf("state directory 0700 owned by the user: %v; run directory for the socket 0755: %v", state, run)
|
|
|
|
|
}
|
|
|
|
|
a := byType["archive"][0]
|
|
|
|
|
if a["artifact"] != "cli" || a["path"] != "/usr/local/bin" {
|
|
|
|
|
t.Errorf("archive = %v, want the cli unpacked into /usr/local/bin", a)
|
|
|
|
|
if a["artifact"] != "cli" || a["path"] != "/usr/local/lib/mesh-delivery-view" {
|
|
|
|
|
t.Errorf("archive = %v, want the cli unpacked into its own directory", a)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -195,3 +195,28 @@ func TestAliasItem(t *testing.T) { // 1137/AC1
|
|
|
|
|
t.Fatalf("files/zsh-normal = %q, want the one line", raw)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The controller refuses two modules declaring one path (internal/catalogue/resolve.go:1160-1168). mesh-cli (mesh-catalog
|
|
|
|
|
// modules/mesh-cli/module.json) declares /usr/local/bin whole, so this module may place only a file below a shared
|
|
|
|
|
// directory, never the directory itself.
|
|
|
|
|
func TestNoSharedDirectoryIsClaimed(t *testing.T) { // 1134/AC7
|
|
|
|
|
m, _ := load(t)
|
|
|
|
|
shared := map[string]bool{"/usr/local/bin": true, "/usr/local/lib": true, "/usr/bin": true, "/usr/local": true, "/usr/lib": true, "/etc": true, "/opt": true}
|
|
|
|
|
var binary bool
|
|
|
|
|
for _, r := range m.Resources {
|
|
|
|
|
p, _ := r["path"].(string)
|
|
|
|
|
if shared[strings.TrimRight(p, "/")] {
|
|
|
|
|
t.Errorf("resource %v declares the shared directory %s, which mesh-cli and others declare too", r["id"], p)
|
|
|
|
|
}
|
|
|
|
|
if p == "/usr/local/bin/mesh-delivery-cli" && r["type"] == "file" && r["template"] == "files/mesh-delivery-cli" {
|
|
|
|
|
binary = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !binary {
|
|
|
|
|
t.Error("the command is placed as the file /usr/local/bin/mesh-delivery-cli")
|
|
|
|
|
}
|
|
|
|
|
raw, err := os.ReadFile("files/mesh-delivery-cli")
|
|
|
|
|
if err != nil || !strings.Contains(string(raw), "exec /usr/local/lib/mesh-delivery-view/mesh-delivery-cli") {
|
|
|
|
|
t.Errorf("files/mesh-delivery-cli = %q, %v", raw, err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|