Commit 80020a4f authored by Daniele Venzano's avatar Daniele Venzano

Delay startup of tests

parent 1fd44bc5
......@@ -48,6 +48,7 @@ class TestZoeRest:
with open('integration_tests/zapp.json', encoding='utf-8') as data_file:
data = json.loads(data_file.read())
time.sleep(10) # wait for test Zoe to start and load the docker status
req = requests.post(ZOE_API_URI + 'execution', auth=ZOE_AUTH, json={"application": data, "name": "requests"}, timeout=TIMEOUT)
assert req.status_code == 201
exec_id = str(req.json()['execution_id'])
......
......@@ -200,6 +200,9 @@ class DockerEngineBackend(zoe_master.backends.base.BaseBackend):
def list_available_images(self, node_name):
"""List the images available on the specified node."""
node_stats = _checker.host_stats[node_name]
if node_stats.status == 'offline':
return []
return node_stats.images
def update_service(self, service, cores=None, memory=None):
......
......@@ -119,6 +119,8 @@ class DockerStateSynchronizer(threading.Thread):
break
tmp_images.append(image)
self.host_stats[host_config.name].images = tmp_images
self.host_stats[host_config.name].timestamp = time_start
self.host_stats[host_config.name].valid = True
sleep_time = CHECK_INTERVAL - (time.time() - time_start)
if sleep_time <= 0:
......
......@@ -35,6 +35,8 @@ def _digest_application_description(state: SQLManager, execution: Execution):
images += list_available_images(node)
images = [name for image in images for name in image['names']]
if len(images) == 0:
log.warning('The image list reported by the back-end is empty')
for service_descr in execution.description['services']:
if service_descr['image'] not in images:
execution.set_error()
......
......@@ -45,6 +45,7 @@ class NodeStats(Stats):
self.status = 'offline'
self.service_stats = {}
self.images = []
self.valid = False
def serialize(self):
"""Convert the object into a dict."""
......
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