Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
test(controller): add regression test for "start {c_type}" bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mboersma committed Jul 9, 2014
1 parent d5c0d40 commit 155153e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions controller/api/tests/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,30 @@ def test_container_str(self):
"{}.{}.{}".format(container.app, container.type, container.num))
self.assertEqual(str(container),
"{}.{}.{}".format(container.app, container.type, container.num))

def test_container_command_format(self):
# regression test for https://github.com/deis/deis/pull/1285
url = '/api/apps'
body = {'cluster': 'autotest'}
response = self.client.post(url, json.dumps(body), content_type='application/json')
self.assertEqual(response.status_code, 201)
app_id = response.data['id']
# post a new build
url = "/api/apps/{app_id}/builds".format(**locals())
body = {'image': 'autotest/example', 'sha': 'a'*40,
'procfile': json.dumps({'web': 'node server.js', 'worker': 'node worker.js'})}
response = self.client.post(url, json.dumps(body), content_type='application/json')
self.assertEqual(response.status_code, 201)
# scale up
url = "/api/apps/{app_id}/scale".format(**locals())
body = {'web': 1}
response = self.client.post(url, json.dumps(body), content_type='application/json')
self.assertEqual(response.status_code, 204)
url = "/api/apps/{app_id}/containers".format(**locals())
response = self.client.get(url)
# verify that the container._command property got formatted
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.data['results']), 1)
uuid = response.data['results'][0]['uuid']
container = Container.objects.get(uuid=uuid)
self.assertNotIn('{c_type}', container._command)

0 comments on commit 155153e

Please sign in to comment.