Merge lp:~cprov/uci-engine/tarmac-multienv into lp:uci-engine
- tarmac-multienv
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Celso Providelo |
Approved revision: | 927 |
Merged at revision: | 921 |
Proposed branch: | lp:~cprov/uci-engine/tarmac-multienv |
Merge into: | lp:uci-engine |
Diff against target: |
359 lines (+111/-25) 15 files modified
bin/called-by-tarmac.py (+27/-4) juju-deployer/deploy.py (+3/-3) juju-deployer/relations.yaml (+3/-0) juju-deployer/services.yaml.tmpl (+13/-0) tests/deployers.py (+18/-0) tests/test_britney.py (+4/-10) tests/test_bsbuilder.py (+2/-0) tests/test_image_builder.py (+2/-0) tests/test_ppacreator.py (+2/-0) tests/test_publisher.py (+2/-0) tests/test_rabbit.py (+2/-0) tests/test_test_runner.py (+4/-0) tests/test_ticket_system.py (+1/-6) tests/test_validator.py (+2/-0) tests/test_webui.py (+26/-2) |
To merge this branch: | bzr merge lp:~cprov/uci-engine/tarmac-multienv |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent Ladeuil (community) | Approve | ||
Francis Ginther | Needs Information | ||
Review via email: mp+246333@code.launchpad.net |
Commit message
Supporting multi-system deployment for tests.
Description of the change
Supporting multi-system deployment for tests.
`called-
`DeployerTest` was extended to require an specific service, if not available the test is skipped. Existing integration tests were adjusted.
In order to test the feature a minimal 'ci-ubuntucore' configuration was created for deploying rabbit, TR and Apache. There is also an integration test checking that the apache is alive but not configured (:-/).
- 926. By Celso Providelo
-
typo
Vincent Ladeuil (vila) wrote : | # |
Excellent !
I like the way this makes the test dependency purely declarative.
Only one minor nit inline otherwise, good to land.
Celso Providelo (cprov) wrote : | # |
Thanks Francis and Vincent,
I've extended the base test class to fail if 'required_service' is not provided by client implementations, it will force us to write clearer tests.
Let's see if tarmac likes it too.
- 927. By Celso Providelo
-
Addressing review comments, 'required_service' becomes mandatory for test implementations.
Preview Diff
1 | === modified file 'bin/called-by-tarmac.py' | |||
2 | --- bin/called-by-tarmac.py 2014-11-21 13:42:55 +0000 | |||
3 | +++ bin/called-by-tarmac.py 2015-01-14 10:17:09 +0000 | |||
4 | @@ -16,6 +16,14 @@ | |||
5 | 16 | sys.path.insert(0, os.path.join(HERE, '..')) | 16 | sys.path.insert(0, os.path.join(HERE, '..')) |
6 | 17 | from testing import venv | 17 | from testing import venv |
7 | 18 | 18 | ||
8 | 19 | # List of systems that should be deployed before running all tests. | ||
9 | 20 | # It assumes the systems can co-exist under the same tenant, i.e. | ||
10 | 21 | # common services will be shared (e.g. rabbit). | ||
11 | 22 | testing_systems = ( | ||
12 | 23 | 'ci-airline', | ||
13 | 24 | 'ci-ubuntucore', | ||
14 | 25 | ) | ||
15 | 26 | |||
16 | 19 | 27 | ||
17 | 20 | def check_lxc_mounted(): | 28 | def check_lxc_mounted(): |
18 | 21 | out = subprocess.check_output(['mount']) | 29 | out = subprocess.check_output(['mount']) |
19 | @@ -61,6 +69,24 @@ | |||
20 | 61 | return True | 69 | return True |
21 | 62 | 70 | ||
22 | 63 | 71 | ||
23 | 72 | def deploy_testing_systems(): | ||
24 | 73 | """Deploy 'testing_systems'. | ||
25 | 74 | |||
26 | 75 | Stops if `deploy.main()` failed for any specified system and returns | ||
27 | 76 | its 'return_code', otherwise returns ZERO. | ||
28 | 77 | """ | ||
29 | 78 | # deploy.py isn't in our pythonpath when run as a script | ||
30 | 79 | sys.path.append(os.path.abspath('juju-deployer')) | ||
31 | 80 | import deploy | ||
32 | 81 | |||
33 | 82 | rc = 0 | ||
34 | 83 | for name in testing_systems: | ||
35 | 84 | rc = deploy.main(['--name', name]) | ||
36 | 85 | if rc != 0: | ||
37 | 86 | break | ||
38 | 87 | return rc | ||
39 | 88 | |||
40 | 89 | |||
41 | 64 | def destroy_environment(): | 90 | def destroy_environment(): |
42 | 65 | '''Destroy the local environment. Return True if successful, False | 91 | '''Destroy the local environment. Return True if successful, False |
43 | 66 | otherwise.''' | 92 | otherwise.''' |
44 | @@ -200,9 +226,6 @@ | |||
45 | 200 | raise | 226 | raise |
46 | 201 | 227 | ||
47 | 202 | from testing import run_tests | 228 | from testing import run_tests |
48 | 203 | # deploy.py isn't in our pythonpath when run as a script | ||
49 | 204 | sys.path.append(os.path.abspath('juju-deployer')) | ||
50 | 205 | import deploy | ||
51 | 206 | 229 | ||
52 | 207 | try: | 230 | try: |
53 | 208 | with open('/dev/null', 'w') as null: | 231 | with open('/dev/null', 'w') as null: |
54 | @@ -221,7 +244,7 @@ | |||
55 | 221 | logging.info('Deploying.') | 244 | logging.info('Deploying.') |
56 | 222 | t = time.time() | 245 | t = time.time() |
57 | 223 | # Bootstrap, then deploy. | 246 | # Bootstrap, then deploy. |
59 | 224 | if not bootstrap() or deploy.main() != 0: | 247 | if not bootstrap() or deploy_testing_systems() != 0: |
60 | 225 | metrics.timing('counters.failures.deploy') | 248 | metrics.timing('counters.failures.deploy') |
61 | 226 | return 1 | 249 | return 1 |
62 | 227 | metrics.timing('deploy') | 250 | metrics.timing('deploy') |
63 | 228 | 251 | ||
64 | === modified file 'juju-deployer/deploy.py' | |||
65 | --- juju-deployer/deploy.py 2015-01-06 18:41:34 +0000 | |||
66 | +++ juju-deployer/deploy.py 2015-01-14 10:17:09 +0000 | |||
67 | @@ -933,7 +933,7 @@ | |||
68 | 933 | help='Build the deployment for --working-dir.') | 933 | help='Build the deployment for --working-dir.') |
69 | 934 | parser.add_argument('--name', default='ci-airline', | 934 | parser.add_argument('--name', default='ci-airline', |
70 | 935 | choices=('ci-airline', 'ci-airline-experimental', | 935 | choices=('ci-airline', 'ci-airline-experimental', |
72 | 936 | 'ci-airline-for-britney'), | 936 | 'ci-airline-for-britney', 'ci-ubuntucore'), |
73 | 937 | help='''The name of the juju-deployer "stack". | 937 | help='''The name of the juju-deployer "stack". |
74 | 938 | Default=%(default)s''') | 938 | Default=%(default)s''') |
75 | 939 | parser.add_argument( | 939 | parser.add_argument( |
76 | @@ -987,8 +987,8 @@ | |||
77 | 987 | bootstrap() | 987 | bootstrap() |
78 | 988 | 988 | ||
79 | 989 | 989 | ||
82 | 990 | def main(): | 990 | def main(args=None): |
83 | 991 | args = _get_args() | 991 | args = _get_args(args) |
84 | 992 | 992 | ||
85 | 993 | # You can configure the system to use private PPAs only or by providing | 993 | # You can configure the system to use private PPAs only or by providing |
86 | 994 | # the option --private-ppas-only or by setting the environment variable | 994 | # the option --private-ppas-only or by setting the environment variable |
87 | 995 | 995 | ||
88 | === modified file 'juju-deployer/relations.yaml' | |||
89 | --- juju-deployer/relations.yaml 2014-11-26 23:37:34 +0000 | |||
90 | +++ juju-deployer/relations.yaml 2015-01-14 10:17:09 +0000 | |||
91 | @@ -118,3 +118,6 @@ | |||
92 | 118 | - ["ci-airline-nfss-restish:pgsql", "ci-airline-nfss-postgres:db"] | 118 | - ["ci-airline-nfss-restish:pgsql", "ci-airline-nfss-postgres:db"] |
93 | 119 | - ["ci-airline-nfss-apache:reverseproxy", "ci-airline-nfss-restish:website"] | 119 | - ["ci-airline-nfss-apache:reverseproxy", "ci-airline-nfss-restish:website"] |
94 | 120 | - ["ci-airline-nfss-apache", "ci-airline-nfss-content-fetcher"] | 120 | - ["ci-airline-nfss-apache", "ci-airline-nfss-content-fetcher"] |
95 | 121 | |||
96 | 122 | ci-ubuntucore: | ||
97 | 123 | inherits: common | ||
98 | 121 | 124 | ||
99 | === modified file 'juju-deployer/services.yaml.tmpl' | |||
100 | --- juju-deployer/services.yaml.tmpl 2015-01-06 18:41:34 +0000 | |||
101 | +++ juju-deployer/services.yaml.tmpl 2015-01-14 10:17:09 +0000 | |||
102 | @@ -417,3 +417,16 @@ | |||
103 | 417 | ci-airline-nfss-postgres: | 417 | ci-airline-nfss-postgres: |
104 | 418 | branch: lp:charms/trusty/postgresql@95 | 418 | branch: lp:charms/trusty/postgresql@95 |
105 | 419 | charm: postgresql | 419 | charm: postgresql |
106 | 420 | |||
107 | 421 | ci-ubuntucore: | ||
108 | 422 | series: precise | ||
109 | 423 | inherits: common | ||
110 | 424 | services: | ||
111 | 425 | ci-ubuntucore-webui-apache: | ||
112 | 426 | charm: apache2 | ||
113 | 427 | constraints: "mem=1024M" | ||
114 | 428 | branch: lp:charms/precise/apache2@54 | ||
115 | 429 | options: | ||
116 | 430 | enable_modules: "rewrite proxy proxy_http ssl" | ||
117 | 431 | servername: ci_ubuntu_core_webui_apache | ||
118 | 432 | expose: true | ||
119 | 420 | 433 | ||
120 | === modified file 'tests/deployers.py' | |||
121 | --- tests/deployers.py 2014-11-06 13:40:54 +0000 | |||
122 | +++ tests/deployers.py 2015-01-14 10:17:09 +0000 | |||
123 | @@ -97,6 +97,24 @@ | |||
124 | 97 | class DeployerTest(testing.TestCaseWithGnupg): | 97 | class DeployerTest(testing.TestCaseWithGnupg): |
125 | 98 | '''Base class for building juju deployer based tests.''' | 98 | '''Base class for building juju deployer based tests.''' |
126 | 99 | 99 | ||
127 | 100 | required_service = None | ||
128 | 101 | |||
129 | 102 | def setUp(self): | ||
130 | 103 | """Check for 'required_service' availability.""" | ||
131 | 104 | super(DeployerTest, self).setUp() | ||
132 | 105 | self.assertIsNotNone( | ||
133 | 106 | self.required_service, | ||
134 | 107 | "The test class should provide a 'self.required_service' to be " | ||
135 | 108 | "verified before running the tests.") | ||
136 | 109 | status = deploy.juju_status() | ||
137 | 110 | try: | ||
138 | 111 | units = status['services'][self.required_service]['units'] | ||
139 | 112 | units['{}/0'.format(self.required_service)] | ||
140 | 113 | except KeyError: | ||
141 | 114 | self.skipTest( | ||
142 | 115 | 'Required service {} not available'.format( | ||
143 | 116 | self.required_service)) | ||
144 | 117 | |||
145 | 100 | def get_ip_and_port(self, service, unit=0): | 118 | def get_ip_and_port(self, service, unit=0): |
146 | 101 | return juju_get_ip_and_port(service, unit) | 119 | return juju_get_ip_and_port(service, unit) |
147 | 102 | 120 | ||
148 | 103 | 121 | ||
149 | === modified file 'tests/test_britney.py' | |||
150 | --- tests/test_britney.py 2015-01-08 10:42:09 +0000 | |||
151 | +++ tests/test_britney.py 2015-01-14 10:17:09 +0000 | |||
152 | @@ -43,14 +43,6 @@ | |||
153 | 43 | ) | 43 | ) |
154 | 44 | 44 | ||
155 | 45 | 45 | ||
156 | 46 | def requires_britney_deployment(test, status): | ||
157 | 47 | try: | ||
158 | 48 | br = status['services']['ci-airline-for-britney-requests']['units'] | ||
159 | 49 | br['ci-airline-for-britney-requests/0'] | ||
160 | 50 | except KeyError: | ||
161 | 51 | test.skipTest('Not a ci-airline-for-britney deployment') | ||
162 | 52 | |||
163 | 53 | |||
164 | 54 | def get_rabbit_ip(status): | 46 | def get_rabbit_ip(status): |
165 | 55 | units = status['services']['ci-airline-rabbit']['units'] | 47 | units = status['services']['ci-airline-rabbit']['units'] |
166 | 56 | rabbit_ip = units['ci-airline-rabbit/0']['public-address'] | 48 | rabbit_ip = units['ci-airline-rabbit/0']['public-address'] |
167 | @@ -59,6 +51,8 @@ | |||
168 | 59 | 51 | ||
169 | 60 | class TestProcessRequests(deployers.DeployerTest): | 52 | class TestProcessRequests(deployers.DeployerTest): |
170 | 61 | 53 | ||
171 | 54 | required_service = 'ci-airline-for-britney-requests' | ||
172 | 55 | |||
173 | 62 | scenarios = scenarii.multiply_scenarios( | 56 | scenarios = scenarii.multiply_scenarios( |
174 | 63 | # series | 57 | # series |
175 | 64 | ([('trusty', dict(series='trusty', result='PASSED')), | 58 | ([('trusty', dict(series='trusty', result='PASSED')), |
176 | @@ -69,7 +63,6 @@ | |||
177 | 69 | def setUp(self): | 63 | def setUp(self): |
178 | 70 | super(TestProcessRequests, self).setUp() | 64 | super(TestProcessRequests, self).setUp() |
179 | 71 | status = deploy.juju_status() | 65 | status = deploy.juju_status() |
180 | 72 | requires_britney_deployment(self, status) | ||
181 | 73 | deployers.expose_rabbit(self, get_rabbit_ip(status), | 66 | deployers.expose_rabbit(self, get_rabbit_ip(status), |
182 | 74 | 'tester', 's3cr3t') | 67 | 'tester', 's3cr3t') |
183 | 75 | 68 | ||
184 | @@ -175,10 +168,11 @@ | |||
185 | 175 | 168 | ||
186 | 176 | class TestPost(deployers.DeployerTest): | 169 | class TestPost(deployers.DeployerTest): |
187 | 177 | 170 | ||
188 | 171 | required_service = 'ci-airline-for-britney-requests' | ||
189 | 172 | |||
190 | 178 | def setUp(self): | 173 | def setUp(self): |
191 | 179 | super(TestPost, self).setUp() | 174 | super(TestPost, self).setUp() |
192 | 180 | status = deploy.juju_status() | 175 | status = deploy.juju_status() |
193 | 181 | requires_britney_deployment(self, status) | ||
194 | 182 | fixtures.set_uniq_cwd(self) | 176 | fixtures.set_uniq_cwd(self) |
195 | 183 | fixtures.isolate_from_env(self, dict(HOME=self.uniq_dir)) | 177 | fixtures.isolate_from_env(self, dict(HOME=self.uniq_dir)) |
196 | 184 | units = status['services']['ci-airline-rabbit']['units'] | 178 | units = status['services']['ci-airline-rabbit']['units'] |
197 | 185 | 179 | ||
198 | === modified file 'tests/test_bsbuilder.py' | |||
199 | --- tests/test_bsbuilder.py 2014-06-23 19:41:51 +0000 | |||
200 | +++ tests/test_bsbuilder.py 2015-01-14 10:17:09 +0000 | |||
201 | @@ -22,6 +22,8 @@ | |||
202 | 22 | class TestBsBuilder(deployers.DeployerTest): | 22 | class TestBsBuilder(deployers.DeployerTest): |
203 | 23 | """Integration tests for bsbuilder service run on a juju deployment""" | 23 | """Integration tests for bsbuilder service run on a juju deployment""" |
204 | 24 | 24 | ||
205 | 25 | required_service = 'ci-airline-bsb-worker' | ||
206 | 26 | |||
207 | 25 | def test_worker_running(self): | 27 | def test_worker_running(self): |
208 | 26 | '''ensure the rabbit worker is deployed and running''' | 28 | '''ensure the rabbit worker is deployed and running''' |
209 | 27 | self.assert_job_running('ci-airline-bsb-worker') | 29 | self.assert_job_running('ci-airline-bsb-worker') |
210 | 28 | 30 | ||
211 | === modified file 'tests/test_image_builder.py' | |||
212 | --- tests/test_image_builder.py 2014-10-07 10:04:01 +0000 | |||
213 | +++ tests/test_image_builder.py 2015-01-14 10:17:09 +0000 | |||
214 | @@ -22,6 +22,8 @@ | |||
215 | 22 | class TestImageBuilder(deployers.DeployerTest): | 22 | class TestImageBuilder(deployers.DeployerTest): |
216 | 23 | """Integration tests for image builder service run on a juju deployment""" | 23 | """Integration tests for image builder service run on a juju deployment""" |
217 | 24 | 24 | ||
218 | 25 | required_service = 'ci-airline-imagebuild-worker' | ||
219 | 26 | |||
220 | 25 | def test_worker_running(self): | 27 | def test_worker_running(self): |
221 | 26 | '''ensure the rabbit worker is deployed and running''' | 28 | '''ensure the rabbit worker is deployed and running''' |
222 | 27 | self.assert_job_running('ci-airline-imagebuild-worker') | 29 | self.assert_job_running('ci-airline-imagebuild-worker') |
223 | 28 | 30 | ||
224 | === modified file 'tests/test_ppacreator.py' | |||
225 | --- tests/test_ppacreator.py 2014-10-30 20:46:10 +0000 | |||
226 | +++ tests/test_ppacreator.py 2015-01-14 10:17:09 +0000 | |||
227 | @@ -27,6 +27,8 @@ | |||
228 | 27 | class TestPPACreator(deployers.DeployerTest): | 27 | class TestPPACreator(deployers.DeployerTest): |
229 | 28 | """Integration tests for ppacreator service run on a juju deployment""" | 28 | """Integration tests for ppacreator service run on a juju deployment""" |
230 | 29 | 29 | ||
231 | 30 | required_service = 'ci-airline-ppa-creator-worker' | ||
232 | 31 | |||
233 | 30 | def setUp(self): | 32 | def setUp(self): |
234 | 31 | super(TestPPACreator, self).setUp() | 33 | super(TestPPACreator, self).setUp() |
235 | 32 | status = deploy.juju_status() | 34 | status = deploy.juju_status() |
236 | 33 | 35 | ||
237 | === modified file 'tests/test_publisher.py' | |||
238 | --- tests/test_publisher.py 2014-10-07 10:04:01 +0000 | |||
239 | +++ tests/test_publisher.py 2015-01-14 10:17:09 +0000 | |||
240 | @@ -24,6 +24,8 @@ | |||
241 | 24 | class TestPublisher(deployers.DeployerTest): | 24 | class TestPublisher(deployers.DeployerTest): |
242 | 25 | """Integration tests for publisher service run on a juju deployment""" | 25 | """Integration tests for publisher service run on a juju deployment""" |
243 | 26 | 26 | ||
244 | 27 | required_service = 'ci-airline-publisher-worker' | ||
245 | 28 | |||
246 | 27 | def test_worker_running(self): | 29 | def test_worker_running(self): |
247 | 28 | """Ensure the publisher worker is deployed and running.""" | 30 | """Ensure the publisher worker is deployed and running.""" |
248 | 29 | self.assert_job_running('ci-airline-publisher-worker') | 31 | self.assert_job_running('ci-airline-publisher-worker') |
249 | 30 | 32 | ||
250 | === modified file 'tests/test_rabbit.py' | |||
251 | --- tests/test_rabbit.py 2014-10-23 14:07:48 +0000 | |||
252 | +++ tests/test_rabbit.py 2015-01-14 10:17:09 +0000 | |||
253 | @@ -29,6 +29,8 @@ | |||
254 | 29 | @features.requires(features.bootstrapped_juju) | 29 | @features.requires(features.bootstrapped_juju) |
255 | 30 | class TestRabbit(deployers.DeployerTest): | 30 | class TestRabbit(deployers.DeployerTest): |
256 | 31 | 31 | ||
257 | 32 | required_service = RABBIT_SERVICE | ||
258 | 33 | |||
259 | 32 | def setUp(self): | 34 | def setUp(self): |
260 | 33 | super(TestRabbit, self).setUp() | 35 | super(TestRabbit, self).setUp() |
261 | 34 | self.create_user('tester', 's3cr3t') | 36 | self.create_user('tester', 's3cr3t') |
262 | 35 | 37 | ||
263 | === modified file 'tests/test_test_runner.py' | |||
264 | --- tests/test_test_runner.py 2015-01-09 11:24:30 +0000 | |||
265 | +++ tests/test_test_runner.py 2015-01-14 10:17:09 +0000 | |||
266 | @@ -33,6 +33,8 @@ | |||
267 | 33 | class SmokeTestTestRunner(deployers.DeployerTest): | 33 | class SmokeTestTestRunner(deployers.DeployerTest): |
268 | 34 | """Integration tests for test runner service run on a juju deployment""" | 34 | """Integration tests for test runner service run on a juju deployment""" |
269 | 35 | 35 | ||
270 | 36 | required_service = 'ci-airline-tr-rabbit-worker' | ||
271 | 37 | |||
272 | 36 | def test_worker_running(self): | 38 | def test_worker_running(self): |
273 | 37 | '''Ensure the rabbit worker is deployed and running.''' | 39 | '''Ensure the rabbit worker is deployed and running.''' |
274 | 38 | # TODO ev 2014-06-16 We should really write status APIs that | 40 | # TODO ev 2014-06-16 We should really write status APIs that |
275 | @@ -42,6 +44,8 @@ | |||
276 | 42 | 44 | ||
277 | 43 | class TestTestRunner(deployers.DeployerTest): | 45 | class TestTestRunner(deployers.DeployerTest): |
278 | 44 | 46 | ||
279 | 47 | required_service = 'ci-airline-tr-rabbit-worker' | ||
280 | 48 | |||
281 | 45 | def setUp(self): | 49 | def setUp(self): |
282 | 46 | super(TestTestRunner, self).setUp() | 50 | super(TestTestRunner, self).setUp() |
283 | 47 | status = deploy.juju_status() | 51 | status = deploy.juju_status() |
284 | 48 | 52 | ||
285 | === modified file 'tests/test_ticket_system.py' | |||
286 | --- tests/test_ticket_system.py 2014-11-25 01:21:41 +0000 | |||
287 | +++ tests/test_ticket_system.py 2015-01-14 10:17:09 +0000 | |||
288 | @@ -24,12 +24,7 @@ | |||
289 | 24 | class TicketSystemTest(deployers.DeployerTest): | 24 | class TicketSystemTest(deployers.DeployerTest): |
290 | 25 | """Integration tests for ticket-system service run on a juju deployment""" | 25 | """Integration tests for ticket-system service run on a juju deployment""" |
291 | 26 | 26 | ||
298 | 27 | def setUp(self): | 27 | required_service = 'ci-airline-webui-apache' |
293 | 28 | super(TicketSystemTest, self).setUp() | ||
294 | 29 | # Adding get_ip_and_port('ts-django') in order to allow the deployment | ||
295 | 30 | # further time to settle before running the tests. | ||
296 | 31 | # http://pad.lv/1319077 | ||
297 | 32 | self.get_ip_and_port('ci-airline-ts-django') | ||
299 | 33 | 28 | ||
300 | 34 | def get_server_status_and_content(self, url): | 29 | def get_server_status_and_content(self, url): |
301 | 35 | """Issue an WebUI GET and return response and page content.""" | 30 | """Issue an WebUI GET and return response and page content.""" |
302 | 36 | 31 | ||
303 | === modified file 'tests/test_validator.py' | |||
304 | --- tests/test_validator.py 2014-08-14 17:21:56 +0000 | |||
305 | +++ tests/test_validator.py 2015-01-14 10:17:09 +0000 | |||
306 | @@ -21,6 +21,8 @@ | |||
307 | 21 | class TestValidator(deployers.DeployerTest): | 21 | class TestValidator(deployers.DeployerTest): |
308 | 22 | """Integration tests for validator service.""" | 22 | """Integration tests for validator service.""" |
309 | 23 | 23 | ||
310 | 24 | required_service = 'ci-airline-validator-worker' | ||
311 | 25 | |||
312 | 24 | def test_worker_running(self): | 26 | def test_worker_running(self): |
313 | 25 | """Ensure the validator worker is deployed and running.""" | 27 | """Ensure the validator worker is deployed and running.""" |
314 | 26 | self.assert_job_running('ci-airline-validator-worker') | 28 | self.assert_job_running('ci-airline-validator-worker') |
315 | 27 | 29 | ||
316 | === modified file 'tests/test_webui.py' | |||
317 | --- tests/test_webui.py 2015-01-09 13:27:24 +0000 | |||
318 | +++ tests/test_webui.py 2015-01-14 10:17:09 +0000 | |||
319 | @@ -50,8 +50,11 @@ | |||
320 | 50 | def setUp(self): | 50 | def setUp(self): |
321 | 51 | """Sets browser base_url based on the available deployment.""" | 51 | """Sets browser base_url based on the available deployment.""" |
322 | 52 | super(WebUITest, self).setUp() | 52 | super(WebUITest, self).setUp() |
325 | 53 | set_base_url('http://{}/'.format( | 53 | try: |
326 | 54 | deployers.juju_get_ip_and_port('ci-airline-webui-apache')[0])) | 54 | set_base_url('http://{}/'.format( |
327 | 55 | deployers.juju_get_ip_and_port('ci-airline-webui-apache')[0])) | ||
328 | 56 | except KeyError: | ||
329 | 57 | self.skipTest('WebUI not available') | ||
330 | 55 | set_window_size(1280, 1024) | 58 | set_window_size(1280, 1024) |
331 | 56 | 59 | ||
332 | 57 | def test_home(self): | 60 | def test_home(self): |
333 | @@ -535,5 +538,26 @@ | |||
334 | 535 | self.assertEqual('Engine health', active_link.text) | 538 | self.assertEqual('Engine health', active_link.text) |
335 | 536 | 539 | ||
336 | 537 | 540 | ||
337 | 541 | class UbuntuCoreWebUITest(cases.SSTTestCase): | ||
338 | 542 | |||
339 | 543 | browser_factory = browsers.PhantomJSFactory() | ||
340 | 544 | |||
341 | 545 | def setUp(self): | ||
342 | 546 | """Sets browser base_url based on the available deployment.""" | ||
343 | 547 | super(UbuntuCoreWebUITest, self).setUp() | ||
344 | 548 | try: | ||
345 | 549 | set_base_url('http://{}/'.format( | ||
346 | 550 | deployers.juju_get_ip_and_port( | ||
347 | 551 | 'ci-ubuntucore-webui-apache')[0])) | ||
348 | 552 | except KeyError: | ||
349 | 553 | self.skipTest('UbuntuCore WebUI not available') | ||
350 | 554 | set_window_size(1280, 1024) | ||
351 | 555 | |||
352 | 556 | def test_home(self): | ||
353 | 557 | # Placeholder test, since UbuntuCore apache is still unconfigured. | ||
354 | 558 | go_to('/') | ||
355 | 559 | assert_title('403 Forbidden') | ||
356 | 560 | |||
357 | 561 | |||
358 | 538 | if __name__ == "__main__": | 562 | if __name__ == "__main__": |
359 | 539 | unittest.main() | 563 | unittest.main() |
A novel way to solve the problem. Just have a question inline.