Commit 73b58e52 authored by Rafael Monnerat's avatar Rafael Monnerat

ERP5TypeCaucaseTestCase: rely on parseListeningAddress to discover ip address

  SLAPOS_TEST_IPVx isnt available for erp5 tests, and discover based on zserver address
  is a common way of doing it.
parent 272c54de
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import parseListeningAddress
from six import BytesIO from six import BytesIO
import socket import socket
...@@ -81,21 +82,26 @@ class ERP5TypeCaucaseTestCase(ERP5TypeTestCase): ...@@ -81,21 +82,26 @@ class ERP5TypeCaucaseTestCase(ERP5TypeTestCase):
""" """
Start caucased server Start caucased server
""" """
ip, port = os.environ.get('SLAPOS_TEST_IPV6', "::1"),\ zserver = os.environ.get("zserver")
findFreeTCPPort(os.environ.get('SLAPOS_TEST_IPV6', "::1")) ip = "127.0.0.1"
for _ip, _ in parseListeningAddress(zserver):
if _ip is not None:
ip = _ip
break
port = findFreeTCPPort(ip)
self.caucase_runtime = caucase_runtime = multiprocessing.Process( self.caucase_runtime = caucase_runtime = multiprocessing.Process(
target=caucase.http.main, target=caucase.http.main,
kwargs=dict( kwargs=dict(
argv=[ argv=[
'--db', self.caucase_db, '--db', self.caucase_db,
'--server-key', os.path.join(self.caucased, 'server.key.pem'), '--server-key', os.path.join(self.caucased, 'server.key.pem'),
'--netloc', '[%s]:%s' % (ip, port), '--netloc', '%s:%s' % (ip, port),
'--service-auto-approve-count', '0' '--service-auto-approve-count', '0'
] ]
) )
) )
self.caucase_runtime.start() self.caucase_runtime.start()
self.caucase_url = 'http://[%s]:%s' % (ip, port) self.caucase_url = 'http://%s:%s' % (ip, port)
if not retry( if not retry(
lambda: ( lambda: (
......
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