Complete resource inspection validation and coverage

This commit is contained in:
2026-11-06 15:34:21 +00:00
parent 19a0604874
commit f083ad5309
6 changed files with 61 additions and 19 deletions

View File

@@ -51,3 +51,17 @@ func TestResolvedBackendAndProfileResources(t *testing.T) {
t.Fatalf("cancellation = %v", err)
}
}
func TestBackendResourcePreservesInheritedDiagnostics(t *testing.T) {
state, err := load(mapping("backend diagnostics", map[string]any{"backends": []any{
map[string]any{"id": "parent", "endpoint": "https://provider.test/v1", "smoke_tests": map[string]any{"reachability": map[string]any{"endpoint": "https://probe.test/ready"}, "authentication": map[string]any{"kind": "none"}}},
map[string]any{"id": "child", "extends": map[string]any{"id": "parent"}},
}}), nil)
if err != nil {
t.Fatal(err)
}
got, err := state.InspectBackend(context.Background(), "child")
if err != nil || got.ID != "child" || got.ConcurrencyLimit != nil || got.QueueCapacity != nil || got.SmokeTests == nil || got.SmokeTests.Reachability == nil || got.SmokeTests.Reachability.Endpoint == nil || *got.SmokeTests.Reachability.Endpoint != "https://probe.test/ready" || got.SmokeTests.Authentication == nil || got.SmokeTests.Authentication.Kind == nil || *got.SmokeTests.Authentication.Kind != "none" || got.SmokeTests.Authentication.Endpoint != nil {
t.Fatalf("inherited diagnostics = %+v, %v", got, err)
}
}