<p>I am trying to use it to run some integration tests, so to verify the service code I am deploying is actually doing the right thing.</p>

<p>Basically how I setup is (as described here: <a href="https://docs.helm.sh/developing_charts/#chart-tests" rel="nofollow noreferrer">https://docs.helm.sh/developing_charts/#chart-tests</a>) creating this <code>templates/tests/integration-test.yaml</code> chart test file, and inside it specify to run a container, which basically is a customized maven image with test code added in and the test container is simply started by command “mvn test”, which does some simple curl check on the kube service this whole helm release deploys.</p>

<p>In this way, the helm test does work.</p>

<p>However, the issue is, during the helm test is running, the new version of the service code is actually already online and being exposed to the outside world/users. I can of course immediately do a roll back if the helm test fails, but this will not stop me hosting the problem-version of the service code for a while to the outside world.</p>

<p>Is there a way, where one can run a service/integration test on a pod, after the pod is started but before it is exposed to the Kubernetes service?</p>

<p>Ideally you'll install and test on a test environment first, either a dedicated test cluster or namepsace. For an additional check you could install the chart first into a new namespace and let the tests run there and then delete that namespace when it is all passed. This does require writing the tests in a way that they can hit URLs that are specific to that namespace. Cluster-internal URLs based on service names will be namespace-relative anyway but if you use external URLs in the tests then you'd either need to switch them to internal or use prefixing.</p>
