{"version":"https://jsonfeed.org/version/1","title":"Code & Infra by Roberto Scudeller","home_page_url":"https://betorvs.github.io/","feed_url":"https://betorvs.github.io/feed.json","description":"About SRE/DevOps/Platform related topics","favicon":"https://betorvs.github.io//assets/favicon.ico","expired":false,"author":{"name":"Roberto Scudeller","url":"https://betorvs.github.io/"},"items":[{"id":"96ec61324f93f23d39f8b208d53d77f1b12f43eb","title":"E2E Helm Tests","summary":"","content_text":"Moving Beyond Helm Lint: How to Run True E2E Tests on Your Charts We’ve all been there: helm lint passes perfectly, your syntax looks flawless, and you confidently push your chart to production—only for it to crash because of a misspelled environment variable or a misconfigured service account.\nLinting ensures your files are valid YAML and follow best practices. But it doesn\u0026rsquo;t tell you if your templates will actually deploy and function correctly inside a real Kubernetes cluster.\nTo fix that, we need automated End-to-End (E2E) testing. In this post, I’ll walk you through a simple, reproducible workflow to spin up a local ephemeral cluster, deploy your chart, run your test suites, and clean everything up.\nThe E2E Testing Workflow First try to run this example create in this repository below then apply it to your own helm chart.\nClone it: git clone git@github.com:betorvs/article-e2e-helm-tests.git Make sure you have all requirements and using Task task init task tidy task e2e-tests Check the content of example_kind_test.go and verify TestExample function to understand what you can improve to test your application better. podName := \u0026#34;\u0026#34; for _, pod := range podList.Items { if strings.HasPrefix(pod.Name, \u0026#34;example-e2e-kind\u0026#34;) { t.Logf(\u0026#34;Found pod %v with status %v\u0026#34;, pod.Name, pod.Status.Phase) podName = pod.Name break } } if podName == \u0026#34;\u0026#34; { t.Fatalf(\u0026#34;Failed to find pod with name prefix example-e2e-kind\u0026#34;) } Note: In this case I was looking for this pod in any state, but you can be more precise here and even call specific commands to test your application.\nWhy This Matters By wrapping this exact sequence into a local go script and re-use it in your CI pipeline (like GitHub Actions), you achieve absolute confidence in your deployments. If a template change breaks a deployment hook or an ingress configuration, you catch it in seconds on your local machine instead of minutes into a production outage.\nAll the code, sample charts, and automated scripts for this setup are available in my repository.\nCheck out the full implementation here: github.com/betorvs/article-e2e-helm-tests\nHappy deploying!\n","content_html":"\u003ch1 id=\"moving-beyond-helm-lint-how-to-run-true-e2e-tests-on-your-charts\"\u003eMoving Beyond Helm Lint: How to Run True E2E Tests on Your Charts\u003c/h1\u003e\n\u003cp\u003eWe’ve all been there: \u003ccode\u003ehelm lint\u003c/code\u003e passes perfectly, your syntax looks flawless, and you confidently push your chart to production—only for it to crash because of a misspelled environment variable or a misconfigured service account.\u003c/p\u003e\n\u003cp\u003eLinting ensures your files are valid YAML and follow best practices. But it doesn\u0026rsquo;t tell you if your templates will \u003cem\u003eactually\u003c/em\u003e deploy and function correctly inside a real Kubernetes cluster.\u003c/p\u003e\n\u003cp\u003eTo fix that, we need automated End-to-End (E2E) testing. In this post, I’ll walk you through a simple, reproducible workflow to spin up a local ephemeral cluster, deploy your chart, run your test suites, and clean everything up.\u003c/p\u003e\n\u003chr\u003e\n\u003ch2 id=\"the-e2e-testing-workflow\"\u003eThe E2E Testing Workflow\u003c/h2\u003e\n\u003cp\u003eFirst try to run this example create in this repository below then apply it to your own helm chart.\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eClone it:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    git clone git@github.com:betorvs/article-e2e-helm-tests.git\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start=\"2\"\u003e\n\u003cli\u003eMake sure you have all requirements and using \u003ca href=\"https://taskfile.dev/\"\u003eTask\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    task init\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    task tidy\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    task e2e-tests\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col start=\"3\"\u003e\n\u003cli\u003eCheck the content of \u003ccode\u003eexample_kind_test.go\u003c/code\u003e and verify \u003ccode\u003eTestExample\u003c/code\u003e function to understand what you can improve to test your application better.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-go\" data-lang=\"go\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75af00\"\u003epodName\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e:=\u003c/span\u003e \u003cspan style=\"color:#d88200\"\u003e\u0026#34;\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#00a8c8\"\u003efor\u003c/span\u003e \u003cspan style=\"color:#75af00\"\u003e_\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#75af00\"\u003epod\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e:=\u003c/span\u003e \u003cspan style=\"color:#00a8c8\"\u003erange\u003c/span\u003e \u003cspan style=\"color:#75af00\"\u003epodList\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003eItems\u003c/span\u003e \u003cspan style=\"color:#111\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#00a8c8\"\u003eif\u003c/span\u003e \u003cspan style=\"color:#75af00\"\u003estrings\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003eHasPrefix\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e(\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003epod\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003eName\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#d88200\"\u003e\u0026#34;example-e2e-kind\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e)\u003c/span\u003e \u003cspan style=\"color:#111\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\t\u003cspan style=\"color:#75af00\"\u003et\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003eLogf\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e(\u003c/span\u003e\u003cspan style=\"color:#d88200\"\u003e\u0026#34;Found pod %v with status %v\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#75af00\"\u003epod\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003eName\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e,\u003c/span\u003e \u003cspan style=\"color:#75af00\"\u003epod\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003eStatus\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003ePhase\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\t\u003cspan style=\"color:#75af00\"\u003epodName\u003c/span\u003e \u003cspan style=\"color:#111\"\u003e=\u003c/span\u003e \u003cspan style=\"color:#75af00\"\u003epod\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003eName\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\t\u003cspan style=\"color:#00a8c8\"\u003ebreak\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#111\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#111\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#00a8c8\"\u003eif\u003c/span\u003e \u003cspan style=\"color:#75af00\"\u003epodName\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e==\u003c/span\u003e \u003cspan style=\"color:#d88200\"\u003e\u0026#34;\u0026#34;\u003c/span\u003e \u003cspan style=\"color:#111\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\t\u003cspan style=\"color:#75af00\"\u003et\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e.\u003c/span\u003e\u003cspan style=\"color:#75af00\"\u003eFatalf\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e(\u003c/span\u003e\u003cspan style=\"color:#d88200\"\u003e\u0026#34;Failed to find pod with name prefix example-e2e-kind\u0026#34;\u003c/span\u003e\u003cspan style=\"color:#111\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#111\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003e\u003cstrong\u003eNote:\u003c/strong\u003e In this case I was looking for this pod in any state, but you can be more precise here and even call specific commands to test your application.\u003c/p\u003e\n\u003chr\u003e\n\u003ch2 id=\"why-this-matters\"\u003eWhy This Matters\u003c/h2\u003e\n\u003cp\u003eBy wrapping this exact sequence into a local go script and re-use it in your CI pipeline (like GitHub Actions), you achieve absolute confidence in your deployments. If a template change breaks a deployment hook or an ingress configuration, you catch it in seconds on your local machine instead of minutes into a production outage.\u003c/p\u003e\n\u003cp\u003eAll the code, sample charts, and automated scripts for this setup are available in my repository.\u003c/p\u003e\n\u003cp\u003eCheck out the full implementation here: \u003cstrong\u003e\u003ca href=\"https://github.com/betorvs/article-e2e-helm-tests\"\u003egithub.com/betorvs/article-e2e-helm-tests\u003c/a\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eHappy deploying!\u003c/p\u003e\n","url":"https://betorvs.github.io/posts/e2e-helm-tests/","date_published":"1066-01-09T622:11:00-03:00","date_modified":"1066-01-09T622:11:00-03:00","author":{"name":"Roberto Scudeller","url":"https://betorvs.github.io/"}}]}