Skip to content

Commit 01df37f

Browse files
author
Gabriel Monroy
committed
remove sleeps from node tests, test for databag on layer:scale operations
1 parent 56f7ad1 commit 01df37f

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

api/tests/layer.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ def test_layer_scale(self):
111111
body = {'proxy': 2, 'runtime': 4}
112112
response = self.client.post(url, json.dumps(body), content_type='application/json')
113113
self.assertEqual(response.status_code, 200)
114+
self.assertIn('nodes', response.data)
115+
self.assertIn('containers', response.data)
116+
self.assertIn('proxy', response.data)
117+
self.assertIn('release', response.data)
114118
url = '/api/formations/{formation_id}/nodes'.format(**locals())
115119
response = self.client.get(url)
116120
self.assertEqual(response.status_code, 200)
@@ -119,6 +123,11 @@ def test_layer_scale(self):
119123
url = '/api/formations/{formation_id}/scale/layers'.format(**locals())
120124
body = {'proxy': 1, 'runtime': 2}
121125
response = self.client.post(url, json.dumps(body), content_type='application/json')
126+
self.assertEqual(response.status_code, 200)
127+
self.assertIn('nodes', response.data)
128+
self.assertIn('containers', response.data)
129+
self.assertIn('proxy', response.data)
130+
self.assertIn('release', response.data)
122131
url = '/api/formations/{formation_id}/nodes'.format(**locals())
123132
response = self.client.get(url)
124133
self.assertEqual(response.status_code, 200)
@@ -128,6 +137,10 @@ def test_layer_scale(self):
128137
body = {'proxy': 0, 'runtime': 0}
129138
response = self.client.post(url, json.dumps(body), content_type='application/json')
130139
self.assertEqual(response.status_code, 200)
140+
self.assertIn('nodes', response.data)
141+
self.assertIn('containers', response.data)
142+
self.assertIn('proxy', response.data)
143+
self.assertIn('release', response.data)
131144
url = '/api/formations/{formation_id}/nodes'.format(**locals())
132145
response = self.client.get(url)
133146
self.assertEqual(response.status_code, 200)

celerytasks/mock.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11

22
from __future__ import unicode_literals
33

4-
import time
5-
64
from api.models import Node
75
from celery import task
86

@@ -25,7 +23,6 @@ def launch_node(node_id, creds, params, init, ssh_username, ssh_private_key):
2523
node.provider_id = 'i-1234567'
2624
node.metadata = {'state': 'running'}
2725
node.fqdn = 'localhost.localdomain.local'
28-
time.sleep(1)
2926
node.save()
3027

3128

@@ -35,13 +32,11 @@ def terminate_node(node_id, creds, params, provider_id):
3532
node.metadata = {'state': 'terminated'}
3633
node.save()
3734
# delete the node itself from the database
38-
time.sleep(1)
3935
node.delete()
4036

4137

4238
@task(name='mock.converge_node')
4339
def converge_node(node_id, ssh_username, fqdn, ssh_private_key):
4440
output = ""
4541
rc = 0
46-
time.sleep(1)
4742
return output, rc

0 commit comments

Comments
 (0)