Hey All, Is there a way to conditionally assert fields within resources based on templated input?
Here is an example of what I am trying to do.
I have two values files to represent two different test scenarios for asserting a crossplane resource that creates a cluster.
#values-basic.yaml
clusterName: dev
tenant: test
---
#values-hibernation-enabled
clusterName: dev
tenant: test
hibernation:
enabled: true
The resource I apply in my test step
apiVersion: example.org/v1alpha1
kind: Shoot
metadata:
name: shoot
namespace: ($values.tenant)
spec:
parameters:
name: ($values.clusterName)
# I want to only set this if it was set in values file
# IF values.hibernation.enabled
hibernation: ($values.hibernation.enabled)
# Assertion File
kind: Shoot
apiVersion: core.gardener.cloud/v1beta1
metadata:
name: ($values.clusterName)
namespace: (join('-', ['garden', $values.clusterName]))
annotations:
confirmation.gardener.cloud/deletion: 'true'
spec:
# I only want to assert this if it was set in values file
# IF values.hibernation.enabled
hibernation:
enabled: true
I then have a script which loops over all the values files to run
chainsaw test --values ./compositions/shoot/$values_file.
Is something like this possible? Are there any examples I can look through?
Describe your question
Hey All, Is there a way to conditionally assert fields within resources based on templated input?
Here is an example of what I am trying to do. I have two values files to represent two different test scenarios for asserting a crossplane resource that creates a cluster.
The resource I apply in my test step
I then have a script which loops over all the values files to run chainsaw test --values ./compositions/shoot/$values_file.
Is something like this possible? Are there any examples I can look through?
chainsaw version Version
v0.2.8
Additional context
No response