We've had a few out of band discussions about this so opening a broader issue here to track.
I'm considering adding a test phase that the runner executes between build and deploy to complete the story, with the deploy phase relying on all the tests to pass. This could potentially be extended to support other types of tests in the future, either specified by us or by the user through custom scripts, etc. Opening this issue for discussion, any suggestions, specific use cases or feedback welcome.
One idea I'm currently toying with is treating testers in a similar way to the builders and deployers, in that Skaffold supports multiple different implementations. The only real difference is that we can allow multiple testers specified for a given artifact (whereas with builders for example Skaffold only allows one). This would keep things in line with the pluggable architecture of the builders/deployers and make it relatively easy to add new implementations.
Other thoughts here:
go test, mvn test - this could happen within/somehow in conjunction with the build phase One more set of thoughts:
What would be really nice is "easy to use knobs" in skaffold to run 0 unittests, 1-2 focused tests or all my unittests in an easy way per artifact, because that's what I constantly shift around as a developer, and sometimes I even want to do structure tests and integration tests, but those are significantly more rare.
Another idea: I just remembered using https://infinitest.github.io/ back in the day and it was working pretty well for me while doing TDD in an IDE setting.
Unit-tests also produce artifacts: tests reports (tests results, timings, code coverage (xml, html), linters warnings stats...)
Gotchas:
Multi-artifacts verification is indeed some kind of integration test, so we should reuse the deployers, but the workflow is more complicated, notably if we tag/push images to mark them as validated (for example using a release-candidate docker image registry before multi-artifact verification, then a different registry for real deployment).
We also don't want to deploy on the final/real deployment context for integration tests.
Adding discuss label to bring this back up for discussion.
It's likely I haven't run into cases where the functionality proposed here would've been handy, but I don't see myself using it:
wait: true. (You don't _need_ Helm for this anyway; I'd imagine a good old k8s job will do)npm test/gradle test/etc. I actually think that'd be way too implicit.In other words, the way I see it: If I need to run tests in the cluster, I'd use Helm tests. If I need to run functional tests against the cluster, I'd run them from the host (which requires port forwarding). And if I need to run unit tests, I don't need Kubernetes at all.
I believe skaffold can be improved to make testing easier, but what I'm missing is already covered in #4022. And it's a far simpler change.
To add to the discussion, we have several potential use cases. I'm not sure which would be the best to add support for directly in skaffold (or more generally which should or should not be done in general):
Thanks @thomas-riccardi We are working on a PRD and this seems very helpful.
Most helpful comment
Other thoughts here:
go test,mvn test- this could happen within/somehow in conjunction with the build phase