gruntwork-io / terratest

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.
https://terratest.gruntwork.io/
Apache License 2.0
7.47k stars 1.32k forks source link

Test Helm remote repo #1358

Closed jguionnet closed 10 months ago

jguionnet commented 11 months ago

Describe the solution you'd like I would like the helm test feature to support the --repo options, I would like that underneath the following commands could be executed

helm template keda --namespace medieval-38bl76 --set metricsServer.replicaCount=45 --set resources.metricServer.limits.memory=4545Mi --repo https://kedacore.github.io/charts

helm template --namespace keda-system keda -f custom-values.yaml --repo https://kedacore.github.io/charts

I want to verify that my customization on top of chart work from release to release of remote chart I am using

Describe alternatives you've considered

Coding

Additional context Add any other context or screenshots about the feature request here.

merusso commented 11 months ago

Why not add the Helm repo and reference like so?

$ helm repo add kedacore https://kedacore.github.io/charts
$ helm template keda kedacore/keda --namespace keda --version 2.12.0
jguionnet commented 11 months ago

Why not add the Helm repo and reference like so?

$ helm repo add kedacore https://kedacore.github.io/charts
$ helm template keda kedacore/keda --namespace keda --version 2.12.0

I could and how do I do that programmatically with terratest?

denis256 commented 11 months ago
    options := &helm.Options{}
    helm.AddRepo(t, options, "keda", "https://kedacore.github.io/charts")
    helm.RunHelmCommandAndGetOutputE(t, options, "repo", "update")
    helm.RunHelmCommandAndGetStdOutE(t, options, "template", "keda", "kedacore/keda", "--namespace", "keda", "--version", "2.12.0")

https://github.com/denis256/go-tests/tree/master/terratest-helm-test

merusso commented 11 months ago

I was thinking you could also use helm.RenderTemplateE(), but I see that it expects a local chart directory unlike the respective helm template command.