Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test partials directly without a template #226

Open
rperryng opened this issue Oct 13, 2023 · 1 comment
Open

Test partials directly without a template #226

rperryng opened this issue Oct 13, 2023 · 1 comment

Comments

@rperryng
Copy link

rperryng commented Oct 13, 2023

Hello,

I'd like to be able to test the logic of a partial / named template directly.

This was previously open under #21 but later closed without a resolution.

Currently, I believe partials can only be tested through a template that references them, so one possible workaround would be to write a template file that only references the partial, like:

# charts/my-chart/templates/tests-for-partials/my-partial.yaml

name: {{ include "my-chart.my-partial" (dict "hello" "world") }}

The problem with this is that:

  • these template files which only exist to facilitate a test cannot be added to .helmignore, since helm-unittest also won't see the template
  • therefore the template will be included in the helm package artifact, and therefore will always be rendered (unless some logic is included to not render them by default, though this also feels undesirable as it adds unnecessary render time)
@rperryng
Copy link
Author

rperryng commented Oct 13, 2023

I suppose this is functionally a dupe of #171 as well, with the only difference being somewhat semantic: my chart isn't always meant to be a "library" - it has templates that render my partials but for simplicity's sake it would be nice to test complex partials directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant