Commit f5639901 authored by Ivan Tyagov's avatar Ivan Tyagov

Fix testOooUnoMimemapper

Due to a5157949 cloudooo will retry 10 times before raising thus take this into account
Raise rather than swallow.

Test do pass at
https://nexedi.erp5.net/test_result_module/20191227-20A35E0F

/reviewed-on nexedi/cloudooo!21
parent a5157949
Pipeline #7293 failed with stage
in 0 seconds
...@@ -22,11 +22,15 @@ def getServiceManager(host, port, uno_path, office_binary_path): ...@@ -22,11 +22,15 @@ def getServiceManager(host, port, uno_path, office_binary_path):
# Connect to the running OpenOffice.org and get its # Connect to the running OpenOffice.org and get its
# context. # context.
# Retry 10 times if needed. # Retry 10 times if needed.
for i in range(10): max_attempts = 10
for i in range(max_attempts):
try: try:
uno_connection = resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (host, port)) uno_connection = resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (host, port))
break break
except: except:
if i == (max_attempts - 1):
# no use to try, raise accordingly rather than swallow exception
raise
# I don't know how to import com.sun.star.connection.NoConnectException # I don't know how to import com.sun.star.connection.NoConnectException
time.sleep(1) time.sleep(1)
# Get the ServiceManager object # Get the ServiceManager object
......
...@@ -110,9 +110,12 @@ class TestUnoMimeMapper(HandlerTestCase): ...@@ -110,9 +110,12 @@ class TestUnoMimeMapper(HandlerTestCase):
"--office_binary_path=%s" % self.office_binary_path, "--office_binary_path=%s" % self.office_binary_path,
"--hostname=%s" % self.hostname, "--hostname=%s" % self.hostname,
"--port=%s" % self.openoffice_port] "--port=%s" % self.openoffice_port]
stdout, stderr = Popen(command, # due to a5157949fb5fc9e0c4b0b204f0e737c15498cf38
stdout=PIPE, # cloudooo will retry 10 times before raising thus take this into account
stderr=PIPE).communicate() for i in range(10):
stdout, stderr = Popen(command,
stdout=PIPE,
stderr=PIPE).communicate()
self.assertEquals(stdout, '') self.assertEquals(stdout, '')
self.assertTrue(stderr.endswith(error_msg), stderr) self.assertTrue(stderr.endswith(error_msg), stderr)
openoffice.start() openoffice.start()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment