Detach captured backend and profile values
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user