Skip to content

Commit

Permalink
metrics: fixes common.sh function to always return true
Browse files Browse the repository at this point in the history
This PR corrects the init env() helper function, to make that
systemctl always returns true when enumerating masked services,
and preventing the test from failing

Fixes: kata-containers#8242

Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
  • Loading branch information
dborquez committed Oct 16, 2023
1 parent 59e8b1d commit 4f9681b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/metrics/lib/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function init_env()
clean_env_ctr

# restart docker only if it is not masked by systemd
docker_masked="$(systemctl list-unit-files --state=masked | grep -c docker)"
docker_masked="$(systemctl list-unit-files --state=masked | grep -c docker)" || true
if [ "${docker_masked}" -eq 0 ]; then
sudo systemctl restart docker
fi
Expand All @@ -191,7 +191,7 @@ function init_env()
# killed to start test with clean environment.
function kill_processes_before_start()
{
docker_masked="$(systemctl list-unit-files --state=masked | grep -c "${DOCKER_EXE}")"
docker_masked="$(systemctl list-unit-files --state=masked | grep -c "${DOCKER_EXE}")" || true

if [ "${docker_masked}" -eq 0 ]; then
DOCKER_PROCS=$(sudo "${DOCKER_EXE}" ps -q)
Expand Down

0 comments on commit 4f9681b

Please sign in to comment.