Define Markitect resource namespace
Some checks failed
CI / Build and Test (push) Has been cancelled
CI / Lint (push) Has been cancelled

This commit is contained in:
2026-05-17 06:14:04 +02:00
parent 4c9f964425
commit 6586adb4f5
5 changed files with 281 additions and 1 deletions

View File

@@ -87,3 +87,55 @@ resources:
t.Fatalf("minimal manifest did not round-trip: %+v", m)
}
}
func TestMarkitectProtectedSystemNamespaceExampleParses(t *testing.T) {
path := filepath.Join("..", "..", "examples", "markitect", "protected_system_manifest.yaml")
data, err := os.ReadFile(path)
if err != nil {
t.Fatalf("read %s: %v", path, err)
}
var got api.ProtectedSystemManifest
if err := yaml.Unmarshal(data, &got); err != nil {
t.Fatalf("unmarshal: %v", err)
}
if got.ID != "markitect-tool" {
t.Fatalf("ID = %q; want markitect-tool", got.ID)
}
if len(got.ResourceTypes) != 8 {
t.Fatalf("ResourceTypes len = %d; want 8", len(got.ResourceTypes))
}
if got.ResourceTypes[0].Name != "knowledge_base" || got.ResourceTypes[0].ScopeLevel != api.ScopeLevelWorkspace {
t.Fatalf("first ResourceType = %+v; want knowledge_base Workspace", got.ResourceTypes[0])
}
if got.ResourceTypes[7].Name != "export" || got.ResourceTypes[7].ScopeLevel != api.ScopeLevelRecord {
t.Fatalf("last ResourceType = %+v; want export Record", got.ResourceTypes[7])
}
}
func TestMarkitectNamespaceResourceManifestExampleParses(t *testing.T) {
path := filepath.Join("..", "..", "examples", "markitect", "namespace_resource_manifest.yaml")
data, err := os.ReadFile(path)
if err != nil {
t.Fatalf("read %s: %v", path, err)
}
var got api.ResourceManifest
if err := yaml.Unmarshal(data, &got); err != nil {
t.Fatalf("unmarshal: %v", err)
}
if got.CaringProfile != api.CaringProfileCaring040RC2 {
t.Fatalf("CaringProfile = %q; want %q", got.CaringProfile, api.CaringProfileCaring040RC2)
}
if len(got.Resources) != 8 {
t.Fatalf("Resources len = %d; want 8", len(got.Resources))
}
if got.Resources[4].Type != "span" || got.Resources[4].TrustZone != "restricted" {
t.Fatalf("resources[4] = %+v; want restricted span", got.Resources[4])
}
if got.Resources[7].Type != "export" || got.Resources[7].Parent != "workflow-artifact:internal-note-review-run" {
t.Fatalf("resources[7] = %+v; want export child of workflow artifact", got.Resources[7])
}
}