You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone, what do you think of making it possible to generate the expected yaml from a command? Currently there are two ways of writing the expected state:
Directly in yaml
Together with an assertion in a script
My use case is a controller that installs Helm charts, where I would like to make assertions against the helm status output. Since that output does not live on a cluster I currently have to write a script like this:
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: |
expectedNamespace=test-chart
expectedRelease=test-chart
expectedStatus=deployed
helmStatus=$(helm status -n $expectedNamespace $expectedRelease)
if [ $? -ne 0 ]; then
echo "Failed to get Helm release status for $expectedRelease in namespace $expectedNamespace"
exit 1
fi
status=$(echo "$helmStatus" | grep STATUS | awk '{print $2}')
if [ "$status" != "$expectedStatus" ]; then
echo "Expected Helm release $expectedRelease in namespace $expectedNamespace to have status '$expectedStatus', but got '$status'"
exit 1
fi
It would be much nicer if I could give a command that produces a yaml and an expected yaml, then rely on Kuttls internal machinery to compare the two. E.g. something like:
expected:
status: deployed
actual: helm status -o yaml
Do you think it would be possible to add something like this? And if so, what would be the best way to implement it?
The text was updated successfully, but these errors were encountered:
I think it would be doable, but not exactly easy. Here is the function that does the fetching and comparison.
I'd suggest that you write a short proposal how this would look from the user's PoV. The expected yaml would likely go into an assert.yaml file, but what about the command which produces the actual yaml?
Hi everyone, what do you think of making it possible to generate the expected yaml from a command? Currently there are two ways of writing the expected state:
My use case is a controller that installs Helm charts, where I would like to make assertions against the
helm status
output. Since that output does not live on a cluster I currently have to write a script like this:It would be much nicer if I could give a command that produces a yaml and an expected yaml, then rely on Kuttls internal machinery to compare the two. E.g. something like:
Do you think it would be possible to add something like this? And if so, what would be the best way to implement it?
The text was updated successfully, but these errors were encountered: