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
In my particular case, I'm attempting to check if a Deployment contains a container that mounts a particular volume. However, I have multiple volumeMounts that I'm not concerned with
The contains assertion can only validate 1 level deep.
So in your example it can only validate the object structure of the container object and not the container/volumeMount object.
As the focus of youre is pointing to the volumeMounts, the best way to use contain is by setting a more strict path that identifies the volumeMounts
suite: example testtemplates:
- deployment.yamltests:
- it: Should Mount Volumeasserts:
- contains:
any: truepath: spec.template.spec.containers[0].volumeMountscontent:
mountPath: /my-volumename: my-volume
or (when using jsonPath selector in the path)
suite: example testtemplates:
- deployment.yamltests:
- it: Should Mount Volumeasserts:
- contains:
any: truepath: spec.template.spec.containers[?(@.name == "RELEASE-NAME")].volumeMountscontent:
mountPath: /my-volumename: my-volume
I was hoping to avoid needing to "arbitrarily" index into containers with containers[0]. However, your second example achieves exactly what I was hoping to do! Thank you!
In my particular case, I'm attempting to check if a Deployment contains a container that mounts a particular volume. However, I have multiple volumeMounts that I'm not concerned with
I.e., I want to verify the following exists
I'm attempting to use the following
example_test.yaml
However, it appears that the
any: true
doesn't propagateThe text was updated successfully, but these errors were encountered: