package probe import ( "encoding/json" "os" "path/filepath" "testing" ) type executorScenario struct { SchemaVersion int `json:"schemaVersion"` ID string `json:"id"` InitialState struct { Cases []struct { ID string `json:"id"` Type string `json:"type"` ExpectedState string `json:"expectedState"` ErrorClass string `json:"errorClass"` } `json:"cases"` CredentialExpectation string `json:"credentialExpectation"` } `json:"initialState"` ExpectedOutcomes []struct { Assertion string `json:"assertion"` } `json:"expectedOutcomes"` } func TestProbeExecutorScenarioFixtureCoversAcceptanceCases(t *testing.T) { fixturePath := filepath.Join("..", "..", "fixtures", "scenarios", "probe-executor-cases.json") content, err := os.ReadFile(fixturePath) if err != nil { t.Fatal(err) } var scenario executorScenario if err := json.Unmarshal(content, &scenario); err != nil { t.Fatal(err) } if scenario.SchemaVersion != 1 || scenario.ID != "probe-executor-cases" || len(scenario.InitialState.Cases) < 9 || len(scenario.ExpectedOutcomes) < 3 { t.Fatalf("fixture is incomplete: %+v", scenario) } seen := make(map[string]bool) for _, testCase := range scenario.InitialState.Cases { seen[testCase.Type+":"+testCase.ExpectedState] = true } for _, required := range []string{"http:up", "http:down", "http:unknown", "tls:up", "dns:up", "tcp:up", "icmp:unknown"} { if !seen[required] { t.Fatalf("fixture is missing acceptance case %q", required) } } if scenario.InitialState.CredentialExpectation == "" { t.Fatal("fixture does not state the credential redaction expectation") } }