1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

pkgng: convert generator to list for 2.9

Ansible 2.9 can't count items from a generator,
so convert `select` filter output via `list`
before passing to `count`.
This commit is contained in:
Ross Williams 2021-10-13 11:14:11 +00:00
parent b34aa1326e
commit 10a4f5ffcc

View file

@ -439,12 +439,12 @@
assert:
that:
- pkgng_example9_add_annotation.changed
- '(pkgng_example9_add_annotation_verify.stdout_lines | select("match", "ansibletest_example9_[12]\s*:\s*added") | count) == 2'
- '(pkgng_example9_add_annotation_verify.stdout_lines | select("match", "ansibletest_example9_[12]\s*:\s*added") | list | count) == 2'
- pkgng_example9_multiple_annotation.changed
- '(pkgng_example9_multiple_annotation_verify.stdout_lines | select("match", "ansibletest_example9_1\s*:\s*modified") | count) == 1'
- '(pkgng_example9_multiple_annotation_verify.stdout_lines | select("match", "ansibletest_example9_[23]\s*:\s*added") | count) == 2'
- '(pkgng_example9_multiple_annotation_verify.stdout_lines | select("match", "ansibletest_example9_1\s*:\s*modified") | list | count) == 1'
- '(pkgng_example9_multiple_annotation_verify.stdout_lines | select("match", "ansibletest_example9_[23]\s*:\s*added") | list | count) == 2'
- pkgng_example9_add_annotation_old.changed
- '(pkgng_example9_add_annotation_old_verify.stdout_lines | select("match", "ansibletest_example9_[45]\s*:\s*added") | count) == 2'
- '(pkgng_example9_add_annotation_old_verify.stdout_lines | select("match", "ansibletest_example9_[45]\s*:\s*added") | list | count) == 2'
##
## pkgng - example - invalid annotation strings
@ -469,13 +469,13 @@
assert:
that:
# Invalid strings should not change anything
- '(pkgng_example8_invalid_annotation_failure.results | selectattr("changed") | count) == 0'
- '(pkgng_example8_invalid_annotation_failure.results | selectattr("changed") | list | count) == 0'
# Invalid strings should always fail
- '(pkgng_example8_invalid_annotation_failure.results | selectattr("failed", "false") | count) == 0'
- '(pkgng_example8_invalid_annotation_failure.results | selectattr("failed", "false") | list | count) == 0'
# Invalid strings should not cause an exception
- '(pkgng_example8_invalid_annotation_failure.results | selectattr("exception", "defined") | count) == 0'
- '(pkgng_example8_invalid_annotation_failure.results | selectattr("exception", "defined") | list | count) == 0'
# Verify annotations are unaffected
- '(pkgng_example8_invalid_annotation_verify.stdout_lines | select("search", "(naked_string|invalid_operation|empty_first_tag|validsecond|notag)") | count) == 0'
- '(pkgng_example8_invalid_annotation_verify.stdout_lines | select("search", "(naked_string|invalid_operation|empty_first_tag|validsecond|notag)") | list | count) == 0'
##
## pkgng - example - Install single package in jail