summaryrefslogtreecommitdiffstats
path: root/src/service-dbus/test/testService.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/service-dbus/test/testService.py')
-rw-r--r--src/service-dbus/test/testService.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/service-dbus/test/testService.py b/src/service-dbus/test/testService.py
index f509acc..d06e3da 100644
--- a/src/service-dbus/test/testService.py
+++ b/src/service-dbus/test/testService.py
@@ -24,6 +24,8 @@ import subprocess
import lmi.shell as lmishell
import os
import shutil
+import time
+import pywbem # for CIMError
HOST = "localhost"
USER = os.environ.get("LMI_CIMOM_USERNAME", "root")
@@ -107,7 +109,7 @@ class TestServiceProvider(unittest.TestCase):
if service and "@.service" not in service[0]:
sysd_services.append(service)
- sysd_services = dict((s[0], False) for (s) in sysd_services_tmp)
+ sysd_services = dict((s[0], False) for (s) in sysd_services)
# Compare both lists (systemd list and OpenLMI list)
self.assertEqual(set(sysd_services.keys()), set(lmi_services.keys()))
@@ -260,9 +262,20 @@ class TestServiceProvider(unittest.TestCase):
service = self.conn.root.cimv2.LMI_Service.first_instance({"Name": BROKER + ".service"})
service.RestartService()
- self.assertTrue (service.Started)
+ # Wait up to 10 seconds for the CIMOM to start
+ timer = 10
+ while timer > 0:
+ time.sleep(1)
+ try:
+ service = self.conn.root.cimv2.LMI_Service.first_instance({"Name": BROKER + ".service"})
+ if service is not None:
+ break
+ except pywbem.CIMError:
+ pass
+ timer -= 1
+ self.assertGreater(timer, 0, "Timeout while waiting for the cimom to restart.")
- # some silent connection restart will be good
+ self.assertTrue (service.Started)
# now try to cumunicate with broker
servicecups = self.conn.root.cimv2.LMI_Service.first_instance({"Name": "cups.service"})