Let's say I've release that has test suite associated with it.
So the typical installation would look like:
helm upgrade --install service service/
and shortly after:
$ helm test service-test
NAME: service
LAST DEPLOYED: Thu Jul 15 15:45:40 2021
NAMESPACE: default
STATUS: deployed
REVISION: 4
TEST SUITE: service-test
Last Started: Thu Jul 15 15:45:45 2021
Last Completed: Thu Jul 15 15:46:00 2021
Phase: Succeeded
This is how happy path for test suite looks like.
But let's think of less happy scenario:
$ helm test service-test
NAME: service
LAST DEPLOYED: Thu Jul 15 15:45:40 2021
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: service-test
Last Started: Thu Jul 15 15:25:48 2021
Last Completed: Thu Jul 15 15:26:54 2021
Phase: Failed
So there's clear indication of failure and 'Failed' substring can be looked up to trigger helm rollback service 0 thereafter, but this approach looks weird to me.
How do I properly rollback on a failed test suite with helm built-in mechanism or some other tool that does not involve piping helm test command output into sed/awk?