Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional dependencies build in Helm during template rendering #1193

Open
AntonAleksandrov13 opened this issue Oct 26, 2022 · 3 comments
Open
Labels

Comments

@AntonAleksandrov13
Copy link

To whom it may concern,

I am experiencing an issue with parallel unit testing with Helm. I have a number of tests the use function helm.RenderTemplate. As I can see from the source code, it subsequently calls RunHelmCommandAndGetOutputE(t, &Options{}, "dependency", "build", chartDir). While this is a very helpful functionality, I have a feeling that there's no need to run helm dependencies update before each test. That slowdowns the overall execution time, but also causes issues with parallel tests.

For example, in my case I start getting the following:

=== CONT  TestDeploymentRenderPort
    template.go:21: 
                Error Trace:    $HOME/test/unittests/template.go:21
                                                        $HOME/test/unittests/deployment_render_test.go:42
                Error:          Received unexpected error:
                                error while running command: exit status 1; Error: could not download https://charts.bitnami.com/bitnami/redis-16.8.7.tgz: open ../../service-chart/tmpcharts/redis-16.8.7.tgz93759796: no such file or directory
                Test:           TestDeploymentRenderPort

It seems that helm is deleting tmpcharts directory after helm dependency build command ran. I would like to hear your thoughts on this issue.
If anything, I am willing to contribute to make RunHelmCommandAndGetOutputE(t, &Options{}, "dependency", "build", chartDir) optional for example.

@denis256
Copy link
Member

Hi,
was considered in each test copying of chart directory to temporary a folder(files.CopyFolderToTemp()) and executing there helm commands?
Making optional dependency building may introduce dependencies in tests execution

@nieomylnieja
Copy link

@denis256 how is this fixing the issue? You will still run helm dependency build each and every time, you shouldn't be making that decision for your users in first place, I ended up just copying a bunch of code from terratest and writing a wraper myself that only builds dependencies once in TestMain. Having a simple flag for that in Options would be ideal, I'd be more than willing to add a PR with that If you would put a green light on it

@rshutt-va
Copy link

rshutt-va commented May 10, 2023

Even more strange is that the helm.Install workflow does not do ANY dep build; the user must do this before installing (typically for an integration test). It is counterintuitive to have the Template workflow forcibly do the helm dep build vs. the Install workflow not doing it. My preferred solution would be to have the Template workflow omit the dep build and I suggest the user be instructed to do the dep build before any Template workflow as it is with the Install workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants