dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
ac3a84
From 5488431dcbea41bec11f0b1ad0a3769489f68c39 Mon Sep 17 00:00:00 2001
ac3a84
From: Frantisek Sumsal <fsumsal@redhat.com>
ac3a84
Date: Wed, 23 Nov 2022 15:16:41 +0100
ac3a84
Subject: [PATCH] test: skip test_ntp if systemd-timesyncd is not available
ac3a84
ac3a84
We don't ship timesyncd on RHEL, so let's skip the test there.
ac3a84
ac3a84
rhel-only
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 test/units/testsuite-45.sh | 5 +++++
ac3a84
 1 file changed, 5 insertions(+)
ac3a84
ac3a84
diff --git a/test/units/testsuite-45.sh b/test/units/testsuite-45.sh
ac3a84
index 24e888c587..7e757e4b00 100755
ac3a84
--- a/test/units/testsuite-45.sh
ac3a84
+++ b/test/units/testsuite-45.sh
ac3a84
@@ -201,6 +201,11 @@ wait_mon() {
ac3a84
 }
ac3a84
 
ac3a84
 test_ntp() {
ac3a84
+    if ! systemctl list-unit-files -q systemd-timesyncd.service; then
ac3a84
+        echo "systemd-timesyncd is not available, skipping the test..."
ac3a84
+        return 0
ac3a84
+    fi
ac3a84
+
ac3a84
     # timesyncd has ConditionVirtualization=!container by default; drop/mock that for testing
ac3a84
     if systemd-detect-virt --container --quiet; then
ac3a84
         systemctl disable --quiet --now systemd-timesyncd