1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/usr/bin/env python
import json
import os
import unittest
import httplib2
from tests import deployers
class TestTestRunner(deployers.DeployerTest):
"""Integration tests for test runner service run on a juju deployment"""
deployer_cfg = os.path.join(deployers.DEPLOYER_DIR, 'test-runner.yaml')
def post_test_image(self, ticket_id, image_id, package_list,
progress_trigger):
url = 'http://{}:{}/api/v1/test_image'.format(
*self.get_ip_and_port('tr-restish'))
client = httplib2.Http()
resp, content = client.request(
url, 'POST',
headers={'Content-Type': 'application/json'},
body=json.dumps({'ticket_id': ticket_id,
'image_id': image_id,
'package_list': package_list,
'progress_trigger': progress_trigger,
}),
)
return resp, content
def test_test_image_succeeds(self):
resp, content = self.post_test_image('t-rex', 'foo',
['uci-tests'], 'king-kong')
self.assertEqual('204', resp['status'])
self.assertEqual('', content)
def test_worker_running(self):
'''Ensure the rabbit worker is deployed and running.'''
self.assert_job_running('tr_rabbit_worker', 'tr-rabbit-worker')
if __name__ == "__main__":
unittest.main()
|