From 18a15468856fbd9a2997adffc719b01ebaaf3725 Mon Sep 17 00:00:00 2001 From: Nick MacCarthy Date: Wed, 17 Jun 2026 08:31:30 -0400 Subject: [PATCH 1/4] test: add helm-unittest suites and CI for kafka-ui chart Introduce helm-unittest as a fast, cluster-free unit-testing harness for the kafka-ui chart, plus a CI job that runs it on every chart PR. Suites cover the core templates: - ingress.yaml API version selection, TLS, ingressClassName, templated host - service.yaml type/port, NodePort/LoadBalancer specifics, selector labels - deployment.yaml replicas vs. autoscaling, image reference, probes, env wiring - NOTES.txt ClusterIP port-forward fallback A tests/README.md documents how to run the suites and the pattern for adding tests when new templates or features land. The new `unit-test` job in .github/workflows/helm.yaml installs the plugin and runs `helm unittest charts/kafka-ui`. --- .github/workflows/helm.yaml | 13 ++ charts/kafka-ui/Chart.yaml | 2 +- charts/kafka-ui/tests/README.md | 57 +++++++ charts/kafka-ui/tests/deployment_test.yaml | 172 +++++++++++++++++++++ charts/kafka-ui/tests/ingress_test.yaml | 146 +++++++++++++++++ charts/kafka-ui/tests/notes_test.yaml | 10 ++ charts/kafka-ui/tests/service_test.yaml | 80 ++++++++++ 7 files changed, 479 insertions(+), 1 deletion(-) create mode 100644 charts/kafka-ui/tests/README.md create mode 100644 charts/kafka-ui/tests/deployment_test.yaml create mode 100644 charts/kafka-ui/tests/ingress_test.yaml create mode 100644 charts/kafka-ui/tests/notes_test.yaml create mode 100644 charts/kafka-ui/tests/service_test.yaml diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml index 2dbdd77..8269ddc 100644 --- a/.github/workflows/helm.yaml +++ b/.github/workflows/helm.yaml @@ -7,6 +7,19 @@ on: paths: - "charts/**" jobs: + unit-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Helm tool installer + uses: Azure/setup-helm@v3 + + - name: Install helm-unittest plugin + run: helm plugin install https://github.com/helm-unittest/helm-unittest + + - name: Run helm unit tests + run: helm unittest charts/kafka-ui + build-and-test: runs-on: ubuntu-latest steps: diff --git a/charts/kafka-ui/Chart.yaml b/charts/kafka-ui/Chart.yaml index 13a1a6c..58939ff 100644 --- a/charts/kafka-ui/Chart.yaml +++ b/charts/kafka-ui/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v2 name: kafka-ui description: A Helm chart for kafka-UI type: application -version: 1.6.4 +version: 1.6.6 appVersion: v1.5.0 icon: https://raw.githubusercontent.com/kafbat/kafka-ui/main/documentation/images/logo_new.png diff --git a/charts/kafka-ui/tests/README.md b/charts/kafka-ui/tests/README.md new file mode 100644 index 0000000..6e26dac --- /dev/null +++ b/charts/kafka-ui/tests/README.md @@ -0,0 +1,57 @@ +# Chart unit tests + +These suites use [`helm-unittest`](https://github.com/helm-unittest/helm-unittest) +to render the chart's templates and assert on the resulting manifests. They run +in milliseconds, need no Kubernetes cluster, and catch template regressions +(missing fields, broken conditionals, failed `fail`/`required` guards) before a +change is ever applied. + +## Running locally + +Install the plugin once: + +```bash +helm plugin install https://github.com/helm-unittest/helm-unittest +``` + +Then run the suites from the repository root: + +```bash +helm unittest charts/kafka-ui +``` + +## Layout + +One suite per template, named `