From 6c5f9810b06aba58f47a487531dd79baed4029e5 Mon Sep 17 00:00:00 2001 From: Ross Williams Date: Tue, 12 Oct 2021 13:43:05 +0000 Subject: [PATCH] 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` --- tests/integration/targets/pkgng/tasks/freebsd.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/targets/pkgng/tasks/freebsd.yml b/tests/integration/targets/pkgng/tasks/freebsd.yml index b7b2a35636..5f0aee00f3 100644 --- a/tests/integration/targets/pkgng/tasks/freebsd.yml +++ b/tests/integration/targets/pkgng/tasks/freebsd.yml @@ -202,8 +202,8 @@ that: - not pkgng_example5_prepare.changed - pkgng_example5.changed - - "'Number of packages to be installed: 3' is in(pkgng_example5.stdout_lines)" - - "(pkgng_example5.stdout | regex_findall('^Number of packages to be', multiline=True) | count) == 1" + - '(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_cleanup.changed ## @@ -245,12 +245,12 @@ - not pkgng_example6_check.changed - not pkgng_example6_prepare.failed - pkgng_example6.changed - - "'Number of packages to be installed: 1' is in(pkgng_example6.stdout_lines)" - - "'Number of packages to be upgraded: 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' + - '(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 # that the module runs two separate commands for install and upgrade, # 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 ##