Detach captured backend and profile values

This commit is contained in:
2026-11-05 20:07:55 +00:00
parent 6c015a17fa
commit 88725e79ab
6 changed files with 29 additions and 42 deletions

View File

@@ -19,10 +19,7 @@ func TestCloneBackendCopiesDiagnosticMetadataAndProviderValues(t *testing.T) {
},
}
cloned, err := CloneBackend(backend)
if err != nil {
t.Fatal(err)
}
cloned := CloneBackend(backend)
*cloned.SmokeTests.DefaultProfile = "changed"
*cloned.SmokeTests.Reachability.Endpoint = "changed"
*cloned.SmokeTests.Authentication.Kind = "changed"
@@ -37,3 +34,13 @@ func TestCloneBackendCopiesDiagnosticMetadataAndProviderValues(t *testing.T) {
t.Fatalf("source provider parameter changed through clone: %v", got)
}
}
func TestCloneBackendPreservesProviderMapPresence(t *testing.T) {
if cloned := CloneBackend(Backend{}); cloned.ExtraParams != nil {
t.Fatalf("nil provider map became %#v", cloned.ExtraParams)
}
cloned := CloneBackend(Backend{ExtraParams: map[string]any{"empty": map[string]any{}, "null": nil}})
if cloned.ExtraParams == nil || cloned.ExtraParams["empty"].(map[string]any) == nil || cloned.ExtraParams["null"] != nil {
t.Fatalf("provider map presence changed: %#v", cloned.ExtraParams)
}
}