-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I search for items in a list? #133
Comments
Sorry I see it in the docs |
Im reopening because I found contains but not sure how to use it. This is a more specific example:
I can't figure out how to properly describe this in a test. This is not valid:
And this adds "-" to the items
Which doesn't match
|
I also tried this:
The output is confusing because it looks like it should pass:
|
@red8888 did you figure this out? I am trying to test the following and assert only on the first item: volumes:
- name: config-volume
configMap:
name: foobar-ns-app-02
- name: all-vault
projected:
sources:
- secret:
name: common-vault
- configMap:
name: foo-configMap-2
name: foo-configmap-volume-2
- name: foo-secret-volume-2
secret:
items:
- key: foo-key-2
path: foo-key.txt
secretName: 'dev-foo-secret-2' The test: - contains:
path: spec.template.spec.volumes
content:
name: config-volume
configMap:
name: foobar-ns-app-02
count: 1
any: true I get this failure: - asserts[2] `contains` fail
Template: charts-integration-test/charts/app-02/templates/deployment.yaml
DocumentIndex: 0
Path: spec.template.spec.volumes
Expected to contain:
- configMap:
name: foobar-ns-app-02
name: config-volume
Actual:
- configMap:
name: foobar-ns-app-02
name: config-volume
- name: all-vault
projected:
sources:
- secret:
name: common-vault
- configMap:
name: foo-configMap-2
name: foo-configmap-volume-2
- name: foo-secret-volume-2
secret:
items:
- key: foo-key-2
path: foo-key.txt
secretName: dev-foo-secret-2
And I don't know why this doesn't limit the test to only one item from the array. Naturally please assume all indentations are correct because they are :) |
How do I search for a value in a yaml list?
For example say I have this:
I just want to see if
argthree
exists (without having to know the specific index number)That returns an error
expect 'spec.template.spec.containers[0].command' to be a string
If I need to know the specific index it makes it very rigid. Thanks!
The text was updated successfully, but these errors were encountered: