summaryrefslogtreecommitdiffstats
path: root/src/service-dbus
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2013-10-23 09:14:55 +0200
committerJan Safranek <jsafrane@redhat.com>2013-10-23 09:14:55 +0200
commit23e1eeb81fbcb0514c5e84816195e5092c5ff08a (patch)
tree7ac125a7a4a13cecbc218e6dabd429828341207e /src/service-dbus
parentaceb73fd0e634c23c9adcfb5515e5bafa93a8d22 (diff)
downloadopenlmi-providers-23e1eeb81fbcb0514c5e84816195e5092c5ff08a.tar.gz
openlmi-providers-23e1eeb81fbcb0514c5e84816195e5092c5ff08a.tar.xz
openlmi-providers-23e1eeb81fbcb0514c5e84816195e5092c5ff08a.zip
service: fix test_restart_service_broker test, we must wait for the CIMOM to restart.
The test expected that the CIMOM restarts atomically, which is not the case - there are few seconds of no CIM service and the test must wait until the CIMOM becomes online.
Diffstat (limited to 'src/service-dbus')
-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"})