X Tutup
Skip to content

test(config): add failure-case tests for helm template functions#7816

Merged
olblak merged 1 commit intoupdatecli:mainfrom
ak95asb:fix/helmfuncs-failure-case-tests
Feb 23, 2026
Merged

test(config): add failure-case tests for helm template functions#7816
olblak merged 1 commit intoupdatecli:mainfrom
ak95asb:fix/helmfuncs-failure-case-tests

Conversation

@ak95asb
Copy link
Contributor

@ak95asb ak95asb commented Feb 23, 2026

Summary

Resolves the //TODO write tests for failure cases comment in funcsHelm_test.go:28.

Changes:

  • Added errMarshaler test helper — implements yaml.Marshaler and returns
    an error — to exercise the error-swallowing path in toYAML (returns "")
  • Added fromYaml test case with syntactically invalid YAML input,
    asserting the error is embedded under map["Error"]
  • Added fromYamlArray test case with same invalid input, asserting the
    error string is the sole element of the returned slice
  • Removed the TODO comment

Note: channels/funcs panic (not error) in the yaml library so errMarshaler
via the MarshalYAML interface is the correct way to trigger a marshal error.

Test plan

  • go test ./pkg/core/config/ -run TestHelmFuncs — all cases pass

Resolve the TODO in TestHelmFuncs to cover the error-swallowing paths
in toYAML, fromYAML, and fromYAMLArray.

- toYAML: add errMarshaler helper type whose MarshalYAML returns an
  error, confirming the function swallows it and returns an empty string.
- fromYaml: add a syntactically invalid YAML input ("key: [unclosed")
  and assert the error is embedded under map["Error"].
- fromYamlArray: same invalid input, asserting the error string is
  returned as the sole element of the slice.
@olblak olblak merged commit 6f23ed4 into updatecli:main Feb 23, 2026
5 checks passed
@olblak olblak added the chore label Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup