salt/fix-test_system-flaky-setup_teardown-fn.patch
Victor Zhestkov 4eef7e3ea5 - Fix virtual grains for VMs running on Nutanix AHV (bsc#1234022)
- Fix issues running on Python 3.12 and 3.13
- Added:
  * fix-virtual-grains-for-vms-running-on-nutanix-ahv-bs.patch
  * fix-issues-that-break-salt-in-python-3.12-and-3.13-6.patch

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=266
2025-01-22 16:30:18 +00:00

45 lines
1.4 KiB
Diff

From 5567f2bd51d66b7797c986cf64f79f71ca57eb63 Mon Sep 17 00:00:00 2001
From: Marek Czernek <marek.czernek@suse.com>
Date: Wed, 4 Sep 2024 13:10:44 +0200
Subject: [PATCH] Fix test_system flaky setup_teardown fn
---
tests/pytests/functional/modules/test_system.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tests/pytests/functional/modules/test_system.py b/tests/pytests/functional/modules/test_system.py
index 2cd03a3a3e4..270aafbe2cd 100644
--- a/tests/pytests/functional/modules/test_system.py
+++ b/tests/pytests/functional/modules/test_system.py
@@ -4,10 +4,12 @@ import os
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"
@@ -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
--
2.46.0