Build presence-aware execution targets from effective configuration
This commit is contained in:
@@ -48,6 +48,29 @@ func TestRegistryIncludesMaintainedDefinitions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestEffectiveRegistryKeepsLiteralIDsAndOwnsValues(t *testing.T) {
|
||||
params := map[string]any{"nested": map[string]any{"enabled": true}}
|
||||
registry, err := backend.NewEffectiveRegistry(map[string]domain.Backend{
|
||||
" local.v1 ": {Endpoint: validEndpoint, ExtraParams: params, ConcurrencyLimit: 2, QueueCapacitySet: true},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
params["nested"].(map[string]any)["enabled"] = false
|
||||
selected, err := registry.GetBackend(" local.v1 ")
|
||||
if err != nil || selected.ID != " local.v1 " || selected.ExtraParams["nested"].(map[string]any)["enabled"] != true {
|
||||
t.Fatalf("effective registry changed identity or retained caller values: %+v, %v", selected, err)
|
||||
}
|
||||
if _, err := registry.GetBackend("local.v1"); !errors.Is(err, backend.ErrBackendNotFound) {
|
||||
t.Fatalf("trimmed identity unexpectedly matched: %v", err)
|
||||
}
|
||||
selected.ExtraParams["nested"].(map[string]any)["enabled"] = false
|
||||
again, _ := registry.GetBackend(" local.v1 ")
|
||||
if again.ExtraParams["nested"].(map[string]any)["enabled"] != true {
|
||||
t.Fatal("registry lookup exposed its stored values")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistryNormalizesUniqueAdditionsAndIsolatesMutations(t *testing.T) {
|
||||
nested := map[string]int{"limit": 2}
|
||||
extraParams := map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user