Commit bb0ca97b authored by Cédric de Saint Martin's avatar Cédric de Saint Martin Committed by Rafael Monnerat

slapos.proxy: tests: do not wait for fixed time for external proxy to be started.

Also remove trailing whitespaces.
parent 214db720
......@@ -32,6 +32,7 @@ import ConfigParser
import os
import logging
import shutil
import socket
import subprocess
import tempfile
import time
......@@ -41,6 +42,7 @@ from xml_marshaller.xml_marshaller import loads, dumps
import slapos.proxy
import slapos.proxy.views as views
import slapos.slap
import slapos.slap.slap
import sqlite3
......@@ -867,6 +869,8 @@ class TestMultiMasterSupport(MasterMixin):
self.external_proxy_port = 8281
self.external_master_url = 'http://%s:%s' % (self.external_proxy_host, self.external_proxy_port)
self.external_computer_id = 'external_computer'
self.external_proxy_slap = slapos.slap.slap()
self.external_proxy_slap.initializeConnection(self.external_master_url)
super(TestMultiMasterSupport, self).setUp()
......@@ -900,9 +904,16 @@ database_uri = %(tempdir)s/lib/external_proxy.db
# 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 ])
# Wait a bit for proxy to be started
time.sleep(0.5)
self.external_proxy_slap = slapos.slap.slap()
self.external_proxy_slap.initializeConnection(self.external_master_url)
attempts = 0
while (attempts < 20):
try:
self.external_proxy_slap._connection_helper.GET('/')
except slapos.slap.NotFoundError:
break
except socket.error:
attempts = attempts + 1
time.sleep(0.1)
def createSlapOSConfigurationFile(self):
"""
......
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