Skip to content

Commit 47f367d

Browse files
committed
Fix packaging test when checking for cgroups v2
This commit fixes the packaging tests that check for whether or not cgroups v2 are enabled. The problem was that if cgroups v2 were not enabled the mount | grep command would fail with non-zero exit status killing the test. This commit fixes the issue by avoiding that command failing if cgroups v2 are not enabled.
1 parent fb00d48 commit 47f367d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

qa/vagrant/src/test/resources/packaging/tests/80_upgrade.bats

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ load $BATS_UTILS/packages.bash
4242
# Cleans everything for the 1st execution
4343
setup() {
4444
skip_not_dpkg_or_rpm
45-
mount | grep "type cgroup2"
46-
if [[ "$?" == 0 && "$(cat upgrade_from_version)" =~ 5\.1\.[12]|5\.2\.[012]|5\.3\.0 ]]; then
45+
count=$(mount | grep -c "type cgroup2" || true)
46+
if [[ "$count" == "1" && "$(cat upgrade_from_version)" =~ 5\.1\.[12]|5\.2\.[012]|5\.3\.0 ]]; then
4747
skip "version $(cat upgrade_from_version) is broken when cgroups v2 are enabled"
4848
fi
4949

0 commit comments

Comments
 (0)