mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-21 18:50:13 +00:00
test(agentcompat): add evidence validation
Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package evidence
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"github.com/nezhahq/nezha/integration/agentcompat/internal/contract"
|
||||
)
|
||||
|
||||
func TestEvidence_RegistryDefinitionsDriveManifestAndProfiles(t *testing.T) {
|
||||
manifest := EvidenceFiles()
|
||||
for _, definition := range contract.ScenarioDefinitions() {
|
||||
dedicatedName := definition.DedicatedArtifactName()
|
||||
if dedicatedName != "" && !slices.Contains(manifest, dedicatedName) {
|
||||
t.Fatalf("dedicated artifact %q absent from manifest", dedicatedName)
|
||||
}
|
||||
metadata := validMetadata(t, t.TempDir(), definition.Name)
|
||||
profile, err := currentProfile(metadata)
|
||||
if err != nil {
|
||||
t.Fatalf("profile for %q: %v", definition.Name, err)
|
||||
}
|
||||
if profile.DedicatedFile != dedicatedName {
|
||||
t.Fatalf("scenario %q dedicated file=%q want=%q", definition.Name, profile.DedicatedFile, dedicatedName)
|
||||
}
|
||||
if definition.Execution == contract.ScenarioExecutionMetadata && profile.Executable {
|
||||
t.Fatal("metadata profile unexpectedly executable")
|
||||
}
|
||||
if definition.Execution != contract.ScenarioExecutionMetadata && !profile.Executable {
|
||||
t.Fatalf("scenario %q profile is not executable", definition.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user