Skip to content

Commit

Permalink
Fix test_system flaky setup_teardown fn
Browse files Browse the repository at this point in the history
  • Loading branch information
m-czernek authored Sep 4, 2024
1 parent b2faa01 commit 5567f2b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/pytests/functional/modules/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import signal
import subprocess
import textwrap
import time

import pytest

import salt.utils.files
from salt.exceptions import CommandExecutionError

INSIDE_CONTAINER = os.getenv("HOSTNAME", "") == "salt-test-container"

Expand Down Expand Up @@ -80,7 +82,13 @@ def setup_teardown_vars(file, service, system):
file.remove("/etc/machine-info")

if _systemd_timesyncd_available_:
res = service.start("systemd-timesyncd")
try:
res = service.start("systemd-timesyncd")
except CommandExecutionError:
# We possibly did too many restarts in too short time
# Wait 10s (default systemd timeout) and try again
time.sleep(10)
res = service.start("systemd-timesyncd")
assert res


Expand Down

0 comments on commit 5567f2b

Please sign in to comment.