fix: address Copilot review on coalesce warnings

- add missing 'warning:' prefix and terminal period to globals key message
- simplify overly verbose 'skipped value' message (remove YAML-specific wording)
- shorten test assertions to stable key-path fragments

Signed-off-by: Marcus H <jfjrh2014@users.noreply.github.com>
pull/32209/head
Marcus H 1 week ago
parent d9592f1364
commit a3cee86137

@ -180,7 +180,7 @@ func coalesceGlobals(printf printFn, dest, src map[string]any, prefix string, _
}
} else if dv, ok := dg[key]; ok && istable(dv) {
// It's not clear if this condition can actually ever trigger.
printf("key %s is a mapping. Skipping", key)
printf("warning: key %s is a mapping. Skipping.", key)
} else {
// TODO: Do we need to do any additional checking on the value?
dg[key] = val
@ -245,7 +245,7 @@ func coalesceValues(printf printFn, c chart.Charter, v map[string]any, prefix st
// If the original value is nil, there is nothing to coalesce, so we don't print
// the warning
if val != nil {
printf("warning: skipped value for %s.%s: destination is a mapping, but the provided value is not. Use a YAML map (key:value pairs) for this key.", subPrefix, key)
printf("warning: skipped value for %s.%s: destination is a mapping, but the provided value is not.", subPrefix, key)
}
} else {
// If the key is a child chart, coalesce tables with Merge set to true

@ -720,9 +720,9 @@ func TestCoalesceValuesWarnings(t *testing.T) {
}
t.Logf("vals: %v", vals)
assert.Contains(t, warnings, "warning: skipped value for level1.level2.level3.boat: destination is a mapping, but the provided value is not. Use a YAML map (key:value pairs) for this key.")
assert.Contains(t, warnings, "warning: destination for level1.level2.level3.spear.tip is a mapping. Ignoring non-mapping value (true)")
assert.Contains(t, warnings, "warning: cannot overwrite mapping with non-mapping value for level1.level2.level3.spear.sail (map[cotton:true])")
assert.Contains(t, warnings, "skipped value for level1.level2.level3.boat")
assert.Contains(t, warnings, "destination for level1.level2.level3.spear.tip is a mapping")
assert.Contains(t, warnings, "cannot overwrite mapping with non-mapping value for level1.level2.level3.spear.sail")
}
func TestConcatPrefix(t *testing.T) {

Loading…
Cancel
Save