diff --git a/bundle/config/mutator/resourcemutator/configure_cluster_policy_definition.go b/bundle/config/mutator/resourcemutator/configure_cluster_policy_definition.go index c0b1b4b5be7..1e7a0d6f64b 100644 --- a/bundle/config/mutator/resourcemutator/configure_cluster_policy_definition.go +++ b/bundle/config/mutator/resourcemutator/configure_cluster_policy_definition.go @@ -45,7 +45,7 @@ func (c configureClusterPolicyDefinition) Apply(_ context.Context, b *bundle.Bun case dyn.KindInvalid, dyn.KindNil, dyn.KindString: // KindInvalid means the field is absent; leave it for backend validation. continue - case dyn.KindMap, dyn.KindSequence: + case dyn.KindMap: jsonBytes, err := json.Marshal(def.AsAny()) if err != nil { return dyn.InvalidValue, fmt.Errorf("failed to marshal inline %s: %w", field, err) @@ -57,7 +57,7 @@ func (c configureClusterPolicyDefinition) Apply(_ context.Context, b *bundle.Bun default: diags = diags.Append(diag.Diagnostic{ Severity: diag.Error, - Summary: fmt.Sprintf("%s must be a string, map, or sequence, got %s", field, def.Kind()), + Summary: fmt.Sprintf("%s must be a string or map, got %s", field, def.Kind()), Locations: def.Locations(), }) } diff --git a/bundle/config/mutator/resourcemutator/configure_cluster_policy_definition_test.go b/bundle/config/mutator/resourcemutator/configure_cluster_policy_definition_test.go index 5e9d53fed4a..0c889b94655 100644 --- a/bundle/config/mutator/resourcemutator/configure_cluster_policy_definition_test.go +++ b/bundle/config/mutator/resourcemutator/configure_cluster_policy_definition_test.go @@ -27,10 +27,10 @@ func TestConfigureClusterPolicyDefinition(t *testing.T) { want: `{"spark_version":{"type":"fixed","value":"13.3.x"}}`, }, { - name: "definition: inline sequence is marshaled to a JSON string", - field: "definition", - value: []any{"a", "b"}, - want: `["a","b"]`, + name: "definition: inline sequence is rejected", + field: "definition", + value: []any{"a", "b"}, + wantErr: "definition must be a string or map, got sequence", }, { name: "definition: inline string is left unchanged", @@ -47,7 +47,7 @@ func TestConfigureClusterPolicyDefinition(t *testing.T) { name: "definition: non-structured is rejected", field: "definition", value: true, - wantErr: "definition must be a string, map, or sequence, got bool", + wantErr: "definition must be a string or map, got bool", }, { // Number stays a JSON number (30, not "30"). @@ -66,7 +66,7 @@ func TestConfigureClusterPolicyDefinition(t *testing.T) { name: "overrides: non-structured is rejected", field: "policy_family_definition_overrides", value: true, - wantErr: "policy_family_definition_overrides must be a string, map, or sequence, got bool", + wantErr: "policy_family_definition_overrides must be a string or map, got bool", }, }