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

pkgng: pass tests when package dependencies change

Tests that install packages with dependencies were failing
when those dependencies were not already installed, because
the count of installed packages was greater than the count
of requested to be installed packages. This change checks
for a count of installed packages that is greater than or
equal to the count of requested to be installed packages.

Example:
  - Test installs packages `zsh` and `fish`
  - `fish` has a dependency on `pcre2`
  - `pkg` reports `Number of packages to be installed: 3`
This commit is contained in:
Ross Williams 2021-10-12 13:43:05 +00:00
parent 406683383e
commit 6c5f9810b0

View file

@ -202,8 +202,8 @@
that: that:
- not pkgng_example5_prepare.changed - not pkgng_example5_prepare.changed
- pkgng_example5.changed - pkgng_example5.changed
- "'Number of packages to be installed: 3' is in(pkgng_example5.stdout_lines)" - '(pkgng_example5.stdout | regex_search("^Number of packages to be installed: (\d+)", "\\1", multiline=True) | first | int) >= 3'
- "(pkgng_example5.stdout | regex_findall('^Number of packages to be', multiline=True) | count) == 1" - '(pkgng_example5.stdout | regex_findall("^Number of packages to be", multiline=True) | count) == 1'
- pkgng_example5_cleanup.changed - pkgng_example5_cleanup.changed
## ##
@ -245,12 +245,12 @@
- not pkgng_example6_check.changed - not pkgng_example6_check.changed
- not pkgng_example6_prepare.failed - not pkgng_example6_prepare.failed
- pkgng_example6.changed - pkgng_example6.changed
- "'Number of packages to be installed: 1' is in(pkgng_example6.stdout_lines)" - '(pkgng_example6.stdout | regex_search("^Number of packages to be installed: (\d+)", "\\1", multiline=True) | first | int) >= 1'
- "'Number of packages to be upgraded: 1' is in(pkgng_example6.stdout_lines)" - '(pkgng_example6.stdout | regex_search("^Number of packages to be upgraded: (\d+)", "\\1", multiline=True) | first | int) >= 1'
# Checking that "will be affected" occurs twice in the output ensures # Checking that "will be affected" occurs twice in the output ensures
# that the module runs two separate commands for install and upgrade, # that the module runs two separate commands for install and upgrade,
# as the pkg command only outputs the string once per invocation. # as the pkg command only outputs the string once per invocation.
- "(pkgng_example6.stdout | regex_findall('will be affected', multiline=True) | count) == 2" - '(pkgng_example6.stdout | regex_findall("will be affected", multiline=True) | count) == 2'
- pkgng_example6_cleanup.changed - pkgng_example6_cleanup.changed
## ##