Skip to content

Commit 155153e

Browse files
committed
test(controller): add regression test for "start {c_type}" bug
1 parent d5c0d40 commit 155153e

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

controller/api/tests/test_container.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,30 @@ def test_container_str(self):
325325
"{}.{}.{}".format(container.app, container.type, container.num))
326326
self.assertEqual(str(container),
327327
"{}.{}.{}".format(container.app, container.type, container.num))
328+
329+
def test_container_command_format(self):
330+
# regression test for https://github.com/deis/deis/pull/1285
331+
url = '/api/apps'
332+
body = {'cluster': 'autotest'}
333+
response = self.client.post(url, json.dumps(body), content_type='application/json')
334+
self.assertEqual(response.status_code, 201)
335+
app_id = response.data['id']
336+
# post a new build
337+
url = "/api/apps/{app_id}/builds".format(**locals())
338+
body = {'image': 'autotest/example', 'sha': 'a'*40,
339+
'procfile': json.dumps({'web': 'node server.js', 'worker': 'node worker.js'})}
340+
response = self.client.post(url, json.dumps(body), content_type='application/json')
341+
self.assertEqual(response.status_code, 201)
342+
# scale up
343+
url = "/api/apps/{app_id}/scale".format(**locals())
344+
body = {'web': 1}
345+
response = self.client.post(url, json.dumps(body), content_type='application/json')
346+
self.assertEqual(response.status_code, 204)
347+
url = "/api/apps/{app_id}/containers".format(**locals())
348+
response = self.client.get(url)
349+
# verify that the container._command property got formatted
350+
self.assertEqual(response.status_code, 200)
351+
self.assertEqual(len(response.data['results']), 1)
352+
uuid = response.data['results'][0]['uuid']
353+
container = Container.objects.get(uuid=uuid)
354+
self.assertNotIn('{c_type}', container._command)

0 commit comments

Comments
 (0)