-
Notifications
You must be signed in to change notification settings - Fork 30
Description
I'm not sure what's intended here, but I found that helm_template_test can't be used with an installer instead of a chart, despite documentation suggesting it can be used with an installer target:
helm_template_test(
name = "simple_template_test",
installer = ":simple.install",
)
fails to build since chart is a mandatory attribute in helm_template_test:
$ bazel test tests/simple:simple_template_test
ERROR: /home/zachburg/rules_helm/tests/simple/BUILD.bazel:13:19: //tests/simple:simple_template_test: missing value for mandatory attribute 'chart' in 'helm_template_test' rule
ERROR: Error evaluating 'tests/simple:simple_template_test': error loading package 'tests/simple': Package 'tests/simple' contains errors
INFO: Elapsed time: 0.915s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Couldn't start the build. Unable to run tests
Removing the mandatory key from the chart attribute does let the test build, but it fails due to unreachable Kubernetes cluster:
$ bazel run tests/simple:simple_template_test
INFO: Analyzed target //tests/simple:simple_template_test (122 packages loaded, 7455 targets configured).
INFO: Found 1 target...
Target //tests/simple:simple_template_test up-to-date:
bazel-bin/tests/simple/simple_template_test
INFO: Elapsed time: 2.250s, Critical Path: 0.01s
INFO: 1 process: 42 action cache hit, 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: external/bazel_tools/tools/test/test-setup.sh tests/simple/simple_template_test
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //tests/simple:simple_template_test
-----------------------------------------------------------------------------
2025/06/17 17:44:34 /home/zachburg/.cache/bazel/_bazel_zachburg/59881b92faeed38f9bde3360fdeafe1a/execroot/_main/bazel-out/k8-fastbuild/bin/tests/simple/simple_template_test.runfiles/+helm+helm_linux_amd64/helm template simple /tests/simple/simple.tgz
Error: INSTALLATION FAILED: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp [::1]:8080: connect: connection refused
I haven't gotten around to why Helm is trying to find a K8s cluster on localhost, but that doesn't seem right for this test definition.
Is this test meant to install a chart on a running K8s cluster, and confirm template_patterns are in the output from helm install? If so, what happens if the test fails? Is the chart left installed on the cluster?
Or should it be running helm template if passed an installer target? If so, I have unpushed changes for https://github.com/abrisco/rules_helm/blob/e77470d4d3151a9ff3564eb285e94724165faa69/helm/private/runner/runner.go to fix that issue.