Skip to content

Add chartTests.dbInteraction.enabled to skip rendering the test hook - #526

Open
inamdarmihir wants to merge 1 commit into
qdrant:mainfrom
inamdarmihir:feat/246-disable-test-hooks
Open

inamdarmihir wants to merge 1 commit into
qdrant:mainfrom
inamdarmihir:feat/246-disable-test-hooks

Conversation

@inamdarmihir

Copy link
Copy Markdown

The chart always renders the helm.sh/hook: test Pod and ConfigMap from templates/tests/test-db-interaction.yaml. Tools that render the chart and apply every resource they find (Skaffold, Google Cloud Deploy, helm template | kubectl apply) then deploy the test pod and fail or leave it behind, and there is no way to opt out short of unpacking the chart and deleting the tests directory (the workaround reported in #246).

This adds chartTests.dbInteraction.enabled (default true) and wraps the whole test template in it, so with enabled: false neither the Pod nor the ConfigMap is rendered.

  • Default rendering is unchanged: I diffed helm template output before and after, for the test template alone and for the whole chart.
  • With enabled=false the full-chart render has no test-db-interaction resources and no helm.sh/hook annotations. Rendering that single template with -s errors with "could not find template", which is Helm's normal behavior for a template that renders empty.
  • Chart.yaml is untouched, per the release process in CONTRIBUTING.

Usage: helm install qdrant qdrant/qdrant --set chartTests.dbInteraction.enabled=false

Tests (test/qdrant_chart_tests_test.go): default renders the Pod and ConfigMap with the test hook annotation; explicit enabled=true matches the default; enabled=false renders none of the test resources while the StatefulSet is still rendered; custom image and resources still apply. With the chart change stashed, the two enabled=false tests fail.

make lint       # 1 chart linted, 0 failed
make test-unit  # ok github.com/qdrant/qdrant-helm/test

I did not run golangci-lint (not installed locally).

Fixes #246

Allow disabling the helm test Pod and ConfigMap so tools that render and
apply hook resources (e.g. skaffold / Cloud Deploy) do not deploy them.
Defaults to true, so the default rendering is unchanged.

Fixes qdrant#246

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

allow preventing test hooks from being rendered (again)

1 participant