I’m using terratest to do unit test and integration test of a big helm chart. This chart has a lot of other chart dependencies, and the definition looks something like this (there are many other dependencies):
apiVersion: v2
name: chart
description: A Helm chart for deploying Ditto BigPeer Anywhere
type: application
kubeVersion: < 1.28.3
version: 1.19.0
appVersion: 1.19.0
dependencies:
- name: ingress-nginx
condition: feature.ingress-nginx.enabled
repository: "https://kubernetes.github.io/ingress-nginx"
version: 4.8.2
tags:
- ingress
And my code in go to do the integration test looks like this:
package test
import (
"testing"
"github.com/gruntwork-io/terratest/modules/helm"
"github.com/gruntwork-io/terratest/modules/k8s"
"github.com/stretchr/testify/assert"
)
func TestPodDeploysContainerImage(t *testing.T) {
helmChartPath := "../"
kubectlOptions := k8s.NewKubectlOptions("", "", "default")
options := &helm.Options{
ValuesFiles: []string{
"../values.yaml",
},
}
releaseName := "chartname"
helm.Install(t, options, helmChartPath, releaseName)
// here comes the test logic
}
My environment is minikube and I have installed the chart manually and it works, but when a run the tests with go, I get the following error:
error while running command: exit status 1; Error: INSTALLATION FAILED: An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: found in Chart.yaml, but missing in charts/ directory: ingress-nginx, cert-manager, strimzi-kafka-operator, consul
I already ran the dependency build but it doesn’t change anything, the .tgz files in the charts folder are downloaded, but terratest is not able to use them, how can I run the tests?