@@ -36,20 +36,20 @@ def setUp(self):
3636
3737 def test_container_scale (self ):
3838 url = '/api/formations'
39- body = {'id' : 'autotest' , 'flavor' : 'autotest' , 'image' : 'deis/autotest' }
39+ body = {'id' : 'autotest' , 'flavor' : 'autotest' }
4040 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
4141 self .assertEqual (response .status_code , 201 )
4242 formation_id = response .data ['id' ]
43- # scale backends
44- url = '/api/formations/{formation_id}/backends' . format ( ** locals ())
45- response = self .client .get (url )
46- self .assertEqual (response .status_code , 200 )
47- self . assertEqual ( len ( response . data [ 'results' ]), 0 )
48- url = '/api/formations/{formation_id}/scale' .format (** locals ())
49- body = {'backends ' : 4 }
43+ url = '/api/formations/{formation_id}/layers' . format ( ** locals ())
44+ body = { 'id' : 'runtime' , 'run_list' : 'recipe[deis::runtime]' }
45+ response = self .client .post (url , json . dumps ( body ), content_type = 'application/json' )
46+ self .assertEqual (response .status_code , 201 )
47+ # scale runtime layer up
48+ url = '/api/formations/{formation_id}/scale/layers ' .format (** locals ())
49+ body = {'runtime ' : 4 }
5050 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
5151 self .assertEqual (response .status_code , 200 )
52- url = '/api/formations/{formation_id}/backends ' .format (** locals ())
52+ url = '/api/formations/{formation_id}/nodes ' .format (** locals ())
5353 response = self .client .get (url )
5454 self .assertEqual (response .status_code , 200 )
5555 self .assertEqual (len (response .data ['results' ]), 4 )
@@ -59,7 +59,7 @@ def test_container_scale(self):
5959 self .assertEqual (response .status_code , 200 )
6060 self .assertEqual (len (response .data ['results' ]), 0 )
6161 # scale up
62- url = '/api/formations/{formation_id}/scale' .format (** locals ())
62+ url = '/api/formations/{formation_id}/scale/containers ' .format (** locals ())
6363 body = {'web' : 4 , 'worker' : 2 }
6464 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
6565 self .assertEqual (response .status_code , 200 )
@@ -68,15 +68,15 @@ def test_container_scale(self):
6868 self .assertEqual (response .status_code , 200 )
6969 self .assertEqual (len (response .data ['results' ]), 6 )
7070 # scale down
71- url = '/api/formations/{formation_id}/scale' .format (** locals ())
71+ url = '/api/formations/{formation_id}/scale/containers ' .format (** locals ())
7272 body = {'web' : 2 , 'worker' : 1 }
7373 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
7474 url = '/api/formations/{formation_id}/containers' .format (** locals ())
7575 response = self .client .get (url )
7676 self .assertEqual (response .status_code , 200 )
7777 self .assertEqual (len (response .data ['results' ]), 3 )
7878 # scale down to 0
79- url = '/api/formations/{formation_id}/scale' .format (** locals ())
79+ url = '/api/formations/{formation_id}/scale/containers ' .format (** locals ())
8080 body = {'web' : 0 , 'worker' : 0 }
8181 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
8282 self .assertEqual (response .status_code , 200 )
@@ -87,17 +87,17 @@ def test_container_scale(self):
8787
8888 def test_container_balance (self ):
8989 url = '/api/formations'
90- body = {'id' : 'autotest' , 'flavor' : 'autotest' , 'image' : 'deis/autotest' }
90+ body = {'id' : 'autotest' , 'flavor' : 'autotest' }
9191 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
9292 self .assertEqual (response .status_code , 201 )
9393 formation_id = response .data ['id' ]
94- # scale backends
95- url = '/api/formations/{formation_id}/backends' . format ( ** locals ())
96- response = self .client .get (url )
97- self .assertEqual (response .status_code , 200 )
98- self . assertEqual ( len ( response . data [ 'results' ]), 0 )
99- url = '/api/formations/{formation_id}/scale' .format (** locals ())
100- body = {'backends ' : 2 }
94+ url = '/api/formations/{formation_id}/layers' . format ( ** locals ())
95+ body = { 'id' : 'runtime' , 'run_list' : 'recipe[deis::runtime]' }
96+ response = self .client .post (url , json . dumps ( body ), content_type = 'application/json' )
97+ self .assertEqual (response .status_code , 201 )
98+ # scale layer
99+ url = '/api/formations/{formation_id}/scale/layers ' .format (** locals ())
100+ body = {'runtime ' : 2 }
101101 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
102102 self .assertEqual (response .status_code , 200 )
103103 # should start with zero
@@ -106,13 +106,13 @@ def test_container_balance(self):
106106 self .assertEqual (response .status_code , 200 )
107107 self .assertEqual (len (response .data ['results' ]), 0 )
108108 # scale up
109- url = '/api/formations/{formation_id}/scale' .format (** locals ())
109+ url = '/api/formations/{formation_id}/scale/containers ' .format (** locals ())
110110 body = {'web' : 8 , 'worker' : 2 }
111111 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
112112 self .assertEqual (response .status_code , 200 )
113- # scale backends
114- url = '/api/formations/{formation_id}/scale' .format (** locals ())
115- body = {'backends ' : 4 }
113+ # scale layer up
114+ url = '/api/formations/{formation_id}/scale/layers ' .format (** locals ())
115+ body = {'runtime ' : 4 }
116116 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
117117 self .assertEqual (response .status_code , 200 )
118118 # calculate the formation
@@ -136,7 +136,7 @@ def test_container_balance(self):
136136 b_max = max ([ len (by_backend [b ]) for b in by_backend .keys () ])
137137 self .assertLess (b_max - b_min , 2 )
138138 # scale up more
139- url = '/api/formations/{formation_id}/scale' .format (** locals ())
139+ url = '/api/formations/{formation_id}/scale/containers ' .format (** locals ())
140140 body = {'web' : 6 , 'worker' : 4 }
141141 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
142142 self .assertEqual (response .status_code , 200 )
@@ -161,7 +161,7 @@ def test_container_balance(self):
161161 b_max = max ([ len (by_backend [b ]) for b in by_backend .keys () ])
162162 self .assertLess (b_max - b_min , 2 )
163163 # scale down
164- url = '/api/formations/{formation_id}/scale' .format (** locals ())
164+ url = '/api/formations/{formation_id}/scale/containers ' .format (** locals ())
165165 body = {'web' : 2 , 'worker' : 2 }
166166 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
167167 self .assertEqual (response .status_code , 200 )
0 commit comments