Skip to content

Commit

Permalink
Fix test_system flaky setup_teardown fn
Browse files Browse the repository at this point in the history
BACKPORT-UPSTREAM=saltstack#66861
DOWNSTREAM-REF=openSUSE/salt#675
  • Loading branch information
m-czernek authored and agraul committed Jan 27, 2025
1 parent fc4095b commit f5d9632
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 f5d9632

Please sign in to comment.