slapproxy tests: start external proxy using local ipv4 if provided in env.

parent ef03a869
...@@ -865,7 +865,7 @@ class TestMultiMasterSupport(MasterMixin): ...@@ -865,7 +865,7 @@ class TestMultiMasterSupport(MasterMixin):
def setUp(self): def setUp(self):
# XXX don't use lo # XXX don't use lo
self.external_proxy_host = '127.0.0.1' self.external_proxy_host = os.environ.get('LOCAL_IPV4', '127.0.0.1')
self.external_proxy_port = 8281 self.external_proxy_port = 8281
self.external_master_url = 'http://%s:%s' % (self.external_proxy_host, self.external_proxy_port) self.external_master_url = 'http://%s:%s' % (self.external_proxy_host, self.external_proxy_port)
self.external_computer_id = 'external_computer' self.external_computer_id = 'external_computer'
...@@ -888,11 +888,12 @@ class TestMultiMasterSupport(MasterMixin): ...@@ -888,11 +888,12 @@ class TestMultiMasterSupport(MasterMixin):
open(self.external_slapproxy_configuration_file_location, 'w').write("""[slapos] open(self.external_slapproxy_configuration_file_location, 'w').write("""[slapos]
computer_id = %(external_computer_id)s computer_id = %(external_computer_id)s
[slapproxy] [slapproxy]
host = 127.0.0.1 host = %(host)s
port = %(port)s port = %(port)s
database_uri = %(tempdir)s/lib/external_proxy.db database_uri = %(tempdir)s/lib/external_proxy.db
""" % { """ % {
'tempdir': self._tempdir, 'tempdir': self._tempdir,
'host': self.external_proxy_host,
'port': self.external_proxy_port, 'port': self.external_proxy_port,
'external_computer_id': self.external_computer_id 'external_computer_id': self.external_computer_id
}) })
...@@ -901,6 +902,7 @@ database_uri = %(tempdir)s/lib/external_proxy.db ...@@ -901,6 +902,7 @@ database_uri = %(tempdir)s/lib/external_proxy.db
""" """
Start external slapproxy Start external slapproxy
""" """
logging.getLogger().info('Starting external proxy, listening to %s:%s' % (self.external_proxy_host, self.external_proxy_port))
# XXX use current dev version, not standard one installed through package # XXX use current dev version, not standard one installed through package
self.external_proxy_process = subprocess.Popen(['slapos', 'proxy', 'start', '--cfg', self.external_slapproxy_configuration_file_location ]) self.external_proxy_process = subprocess.Popen(['slapos', 'proxy', 'start', '--cfg', self.external_slapproxy_configuration_file_location ])
# Wait a bit for proxy to be started # Wait a bit for proxy to be started
......
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