Merge ~xavpaice/juju-verify:add_functest into ~canonical-solutions-engineering/juju-verify:master
- Git
- lp:~xavpaice/juju-verify
- add_functest
- Merge into master
Status: | Superseded |
---|---|
Proposed branch: | ~xavpaice/juju-verify:add_functest |
Merge into: | ~canonical-solutions-engineering/juju-verify:master |
Diff against target: |
405 lines (+285/-17) 12 files modified
Makefile (+4/-0) README.md (+4/-0) tests/functional/requirements.txt (+2/-0) tests/functional/tests/base.py (+21/-0) tests/functional/tests/bundles/ceph.yaml (+16/-0) tests/functional/tests/bundles/hacluster.yaml (+26/-0) tests/functional/tests/bundles/nova-compute.yaml (+106/-0) tests/functional/tests/bundles/overlays/hacluster.yaml.j2 (+4/-0) tests/functional/tests/test_ceph.py (+26/-0) tests/functional/tests/test_novacompute.py (+20/-0) tests/functional/tests/tests.yaml (+16/-0) tox.ini (+40/-17) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
🤖 prod-jenkaas-bootstack (community) | continuous-integration | Approve | |
Martin Kalcok (community) | Needs Fixing | ||
Canonical Solutions Engineering Team | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2021-04-16.
Commit message
Add functional testing
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
A CI job is currently in progress. A follow up comment will be added when it completes.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
FAILED: Continuous integration, rev:f5e33f9e454
https:/
Executed test runs:
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Xav Paice (xavpaice) wrote : | # |
Test failure was caused by proxy/firewall issues:
fatal: unable to access 'https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
A CI job is currently in progress. A follow up comment will be added when it completes.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
FAILED: Continuous integration, rev:4e5addc7784
https:/
Executed test runs:
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
FAILED: Continuous integration, rev:4e5addc7784
https:/
Executed test runs:
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
- f472b29... by Xav Paice
-
Update functests for some errors
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
A CI job is currently in progress. A follow up comment will be added when it completes.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
PASSED: Continuous integration, rev:4def417ab73
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Martin Kalcok (martin-kalcok) wrote : | # |
Thanks for laying foundation for the func tests. Overall LGTM, I just had 2 small inline comments (only one is really blocking).
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Xav Paice (xavpaice) wrote : | # |
Added a few comments of my own, need to update the commit before merge.
- cf71af9... by Xav Paice
-
fix hacluster functest
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
A CI job is currently in progress. A follow up comment will be added when it completes.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote : | # |
PASSED: Continuous integration, rev:cf71af911c4
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Martin Kalcok (martin-kalcok) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Alvaro Uria (aluria) wrote : | # |
Unmerged commits
- cf71af9... by Xav Paice
-
fix hacluster functest
- f472b29... by Xav Paice
-
Update functests for some errors
- 4e5addc... by Xav Paice
-
Add functional testing
This adds a basic test for Ceph OSD verification.
There is also an outline for Nova Compute, that relies on an action
which is not currently avaialable, therefore the test is not enabled.A bundle for starting testing openstack-
dashboard/ hacluster is included,
but no tests.
Preview Diff
1 | diff --git a/Makefile b/Makefile |
2 | index 19c8c1f..703e60f 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -34,5 +34,9 @@ clean: |
6 | @echo "Cleaning files" |
7 | @git clean -fxd -e '!.idea' |
8 | |
9 | +functional: build |
10 | + @echo "Executing functional tests" |
11 | + @tox -e func |
12 | + |
13 | # The targets below don't depend on a file |
14 | .PHONY: lint test unittest release clean help build build-verify |
15 | diff --git a/README.md b/README.md |
16 | index 592db45..29c3e8e 100644 |
17 | --- a/README.md |
18 | +++ b/README.md |
19 | @@ -55,6 +55,10 @@ Don't forget to add unit and functional tests, and run: |
20 | make test |
21 | ``` |
22 | |
23 | +For functional tests some applications require the use of a VIP. Please ensure |
24 | +you set the environment variable `OS_VIP00` to a suitable VIP address before |
25 | +running functional tests. |
26 | + |
27 | ## Submit a bug |
28 | |
29 | If you prefer, file a bug or feature request at: |
30 | diff --git a/tests/functional/requirements.txt b/tests/functional/requirements.txt |
31 | new file mode 100644 |
32 | index 0000000..e6b19ec |
33 | --- /dev/null |
34 | +++ b/tests/functional/requirements.txt |
35 | @@ -0,0 +1,2 @@ |
36 | +python-openstackclient |
37 | +git+https://github.com/openstack-charmers/zaza.git#egg=zaza |
38 | diff --git a/tests/functional/tests/base.py b/tests/functional/tests/base.py |
39 | new file mode 100644 |
40 | index 0000000..b95ba53 |
41 | --- /dev/null |
42 | +++ b/tests/functional/tests/base.py |
43 | @@ -0,0 +1,21 @@ |
44 | +"""Generic setup for functional tests.""" |
45 | + |
46 | +import unittest |
47 | + |
48 | +from juju import loop |
49 | +import zaza.model |
50 | + |
51 | +from juju_verify import juju_verify |
52 | + |
53 | + |
54 | +class BaseTestCase(unittest.TestCase): |
55 | + """Base class for functional testing of verifiers.""" |
56 | + |
57 | + @classmethod |
58 | + def setUpClass(cls): |
59 | + """Run class setup for running tests.""" |
60 | + super(BaseTestCase, cls).setUpClass() |
61 | + cls.log_level = 'info' |
62 | + cls.check = 'shutdown' |
63 | + juju_verify.config_logger(cls.log_level) |
64 | + cls.model = loop.run(juju_verify.connect_model(zaza.model.CURRENT_MODEL)) |
65 | diff --git a/tests/functional/tests/bundles/ceph.yaml b/tests/functional/tests/bundles/ceph.yaml |
66 | new file mode 100644 |
67 | index 0000000..b13e046 |
68 | --- /dev/null |
69 | +++ b/tests/functional/tests/bundles/ceph.yaml |
70 | @@ -0,0 +1,16 @@ |
71 | +series: xenial |
72 | +applications: |
73 | + ceph-mon: |
74 | + charm: cs:~xavpaice/ceph-mon # https://review.opendev.org/c/openstack/charm-ceph-mon/+/778837 |
75 | + num_units: 3 |
76 | + options: |
77 | + expected-osd-count: 3 |
78 | + monitor-count: 3 |
79 | + ceph-osd: |
80 | + charm: cs:ceph-osd |
81 | + num_units: 3 |
82 | + options: |
83 | + osd-devices: /srv/osd |
84 | +relations: |
85 | +- - ceph-osd:mon |
86 | + - ceph-mon:osd |
87 | diff --git a/tests/functional/tests/bundles/hacluster.yaml b/tests/functional/tests/bundles/hacluster.yaml |
88 | new file mode 100644 |
89 | index 0000000..dd166b7 |
90 | --- /dev/null |
91 | +++ b/tests/functional/tests/bundles/hacluster.yaml |
92 | @@ -0,0 +1,26 @@ |
93 | +series: xenial |
94 | +applications: |
95 | + dashboard-hacluster: |
96 | + charm: cs:~xavpaice/hacluster-0 |
97 | + keystone: |
98 | + charm: cs:keystone |
99 | + num_units: 1 |
100 | + mysql: |
101 | + charm: cs:percona-cluster |
102 | + num_units: 1 |
103 | + nrpe: |
104 | + charm: cs:nrpe |
105 | + openstack-dashboard: |
106 | + charm: cs:openstack-dashboard |
107 | + num_units: 3 |
108 | + options: |
109 | + vip: 10.5.0.250 |
110 | +relations: |
111 | +- - openstack-dashboard:ha |
112 | + - dashboard-hacluster:ha |
113 | +- - mysql:shared-db |
114 | + - keystone:shared-db |
115 | +- - openstack-dashboard:identity-service |
116 | + - keystone:identity-service |
117 | +- - nrpe:nrpe-external-master |
118 | + - openstack-dashboard:nrpe-external-master |
119 | diff --git a/tests/functional/tests/bundles/nova-compute.yaml b/tests/functional/tests/bundles/nova-compute.yaml |
120 | new file mode 100644 |
121 | index 0000000..865ae8b |
122 | --- /dev/null |
123 | +++ b/tests/functional/tests/bundles/nova-compute.yaml |
124 | @@ -0,0 +1,106 @@ |
125 | +series: bionic |
126 | +relations: |
127 | +- - nova-compute:image-service |
128 | + - glance:image-service |
129 | +- - nova-compute:amqp |
130 | + - rabbitmq-server:amqp |
131 | +- - nova-cloud-controller:shared-db |
132 | + - percona-cluster:shared-db |
133 | +- - nova-cloud-controller:identity-service |
134 | + - keystone:identity-service |
135 | +- - nova-cloud-controller:amqp |
136 | + - rabbitmq-server:amqp |
137 | +- - nova-cloud-controller:cloud-compute |
138 | + - nova-compute:cloud-compute |
139 | +- - nova-cloud-controller:image-service |
140 | + - glance:image-service |
141 | +- - keystone:shared-db |
142 | + - percona-cluster:shared-db |
143 | +- - glance:identity-service |
144 | + - keystone:identity-service |
145 | +- - glance:shared-db |
146 | + - percona-cluster:shared-db |
147 | +- - glance:amqp |
148 | + - rabbitmq-server:amqp |
149 | +- - neutron-gateway:amqp |
150 | + - rabbitmq-server:amqp |
151 | +- - nova-cloud-controller:quantum-network-service |
152 | + - neutron-gateway:quantum-network-service |
153 | +- - neutron-api:shared-db |
154 | + - percona-cluster:shared-db |
155 | +- - neutron-api:amqp |
156 | + - rabbitmq-server:amqp |
157 | +- - neutron-api:neutron-api |
158 | + - nova-cloud-controller:neutron-api |
159 | +- - neutron-api:identity-service |
160 | + - keystone:identity-service |
161 | +- - nova-compute:neutron-plugin |
162 | + - neutron-openvswitch:neutron-plugin |
163 | +- - rabbitmq-server:amqp |
164 | + - neutron-openvswitch:amqp |
165 | +- - placement:shared-db |
166 | + - percona-cluster:shared-db |
167 | +- - placement:identity-service |
168 | + - keystone:identity-service |
169 | +- - placement:placement |
170 | + - nova-cloud-controller:placement |
171 | +applications: |
172 | + rabbitmq-server: |
173 | + charm: cs:~openstack-charmers-next/rabbitmq-server |
174 | + num_units: 1 |
175 | + percona-cluster: |
176 | + charm: cs:~openstack-charmers-next/percona-cluster |
177 | + num_units: 1 |
178 | + options: |
179 | + max-connections: 1000 |
180 | + innodb-buffer-pool-size: 256M |
181 | + nova-cloud-controller: |
182 | + charm: cs:~openstack-charmers-next/nova-cloud-controller |
183 | + num_units: 1 |
184 | + options: |
185 | + openstack-origin: cloud:bionic-ussuri |
186 | + network-manager: Neutron |
187 | + debug: true |
188 | + neutron-api: |
189 | + charm: cs:~openstack-charmers-next/neutron-api |
190 | + num_units: 1 |
191 | + options: |
192 | + manage-neutron-plugin-legacy-mode: true |
193 | + openstack-origin: cloud:bionic-ussuri |
194 | + flat-network-providers: physnet1 |
195 | + neutron-security-groups: true |
196 | + keystone: |
197 | + charm: cs:~openstack-charmers-next/keystone |
198 | + num_units: 1 |
199 | + options: |
200 | + openstack-origin: cloud:bionic-ussuri |
201 | + neutron-gateway: |
202 | + charm: cs:~openstack-charmers-next/neutron-gateway |
203 | + num_units: 1 |
204 | + options: |
205 | + openstack-origin: cloud:bionic-ussuri |
206 | + bridge-mappings: physnet1:br-ex |
207 | + glance: |
208 | + charm: cs:~openstack-charmers-next/glance |
209 | + num_units: 1 |
210 | + options: |
211 | + openstack-origin: cloud:bionic-ussuri |
212 | + neutron-openvswitch: |
213 | + charm: cs:~openstack-charmers-next/neutron-openvswitch |
214 | + placement: |
215 | + charm: cs:~openstack-charmers-next/placement |
216 | + num_units: 1 |
217 | + options: |
218 | + openstack-origin: cloud:bionic-ussuri |
219 | + nova-compute: |
220 | + charm: cs:~martin-kalcok/nova-compute-0 |
221 | + num_units: 1 |
222 | + constraints: mem=4G cores=4 |
223 | + options: |
224 | + openstack-origin: cloud:bionic-ussuri |
225 | + config-flags: auto_assign_floating_ip=False |
226 | + enable-live-migration: false |
227 | + aa-profile-mode: enforce |
228 | + ephemeral-device: /dev/vdb |
229 | + ephemeral-unmount: /mnt |
230 | + debug: true |
231 | diff --git a/tests/functional/tests/bundles/overlays/hacluster.yaml.j2 b/tests/functional/tests/bundles/overlays/hacluster.yaml.j2 |
232 | new file mode 100644 |
233 | index 0000000..829e57a |
234 | --- /dev/null |
235 | +++ b/tests/functional/tests/bundles/overlays/hacluster.yaml.j2 |
236 | @@ -0,0 +1,4 @@ |
237 | +applications: |
238 | + openstack-dashboard: |
239 | + options: |
240 | + vip: '{{ OS_VIP00 }}' |
241 | diff --git a/tests/functional/tests/test_ceph.py b/tests/functional/tests/test_ceph.py |
242 | new file mode 100644 |
243 | index 0000000..4fce49e |
244 | --- /dev/null |
245 | +++ b/tests/functional/tests/test_ceph.py |
246 | @@ -0,0 +1,26 @@ |
247 | +"""Test deployment and functionality of juju-verify.""" |
248 | + |
249 | +from juju import loop |
250 | +from tests.base import BaseTestCase |
251 | + |
252 | +from juju_verify import juju_verify |
253 | +from juju_verify.verifiers import get_verifier |
254 | + |
255 | + |
256 | +class CephTests(BaseTestCase): |
257 | + """Functional testing for Ceph verifier.""" |
258 | + |
259 | + # To add: |
260 | + # test not OK for two ceph-osd unit stops |
261 | + # test we get a warning when a machine also hosts another unit |
262 | + |
263 | + def test_single_osd_unit(self): |
264 | + """Test that shutdown of a single unit returns OK.""" |
265 | + # juju-verify shutdown --units ceph-osd/1 |
266 | + |
267 | + units = ['ceph-osd/0'] |
268 | + check = 'shutdown' |
269 | + unit_objects = loop.run(juju_verify.find_units(self.model, units)) |
270 | + verifier = get_verifier(unit_objects) |
271 | + result = verifier.verify(check) |
272 | + self.assertTrue(result.success is True) |
273 | diff --git a/tests/functional/tests/test_novacompute.py b/tests/functional/tests/test_novacompute.py |
274 | new file mode 100644 |
275 | index 0000000..4bd8a6b |
276 | --- /dev/null |
277 | +++ b/tests/functional/tests/test_novacompute.py |
278 | @@ -0,0 +1,20 @@ |
279 | +"""Test deployment and functionality of juju-verify.""" |
280 | + |
281 | +from juju import loop |
282 | +from tests.base import BaseTestCase |
283 | + |
284 | +from juju_verify import juju_verify |
285 | +from juju_verify.verifiers import get_verifier |
286 | + |
287 | + |
288 | +class NovaCompute(BaseTestCase): |
289 | + """Base class for functional testing of nova-compute verifier.""" |
290 | + |
291 | + def test_single_unit(self): |
292 | + """Test that shutdown of a single unit returns OK.""" |
293 | + units = ['nova-compute/0'] |
294 | + check = 'shutdown' |
295 | + unit_objects = loop.run(juju_verify.find_units(self.model, units)) |
296 | + verifier = get_verifier(unit_objects) |
297 | + result = verifier.verify(check) |
298 | + print(str(result)) |
299 | diff --git a/tests/functional/tests/tests.yaml b/tests/functional/tests/tests.yaml |
300 | new file mode 100644 |
301 | index 0000000..c4355fa |
302 | --- /dev/null |
303 | +++ b/tests/functional/tests/tests.yaml |
304 | @@ -0,0 +1,16 @@ |
305 | +tests: |
306 | + - nova-compute: |
307 | + - tests.test_novacompute.NovaCompute |
308 | + - ceph: |
309 | + - tests.test_ceph.CephTests |
310 | +gate_bundles: |
311 | + #- nova-compute: nova-compute |
312 | + - ceph: ceph |
313 | +configure: |
314 | + nova-comppute: |
315 | + - zaza.openstack.charm_tests.glance.setup.add_cirros_image |
316 | + - zaza.openstack.charm_tests.glance.setup.add_lts_image |
317 | + - zaza.openstack.charm_tests.keystone.setup.add_demo_user |
318 | + - zaza.openstack.charm_tests.neutron.setup.basic_overcloud_network |
319 | + - zaza.openstack.charm_tests.nova.setup.create_flavors |
320 | + - zaza.openstack.charm_tests.nova.setup.manage_ssh_key |
321 | diff --git a/tox.ini b/tox.ini |
322 | index db91995..0cce781 100644 |
323 | --- a/tox.ini |
324 | +++ b/tox.ini |
325 | @@ -1,12 +1,26 @@ |
326 | [tox] |
327 | skipsdist=True |
328 | -envlist = lint, unit |
329 | +envlist = lint, unit, func |
330 | skip_missing_interpreters = True |
331 | |
332 | [testenv] |
333 | basepython = python3 |
334 | setenv = |
335 | - PYTHONPATH = . |
336 | + PYTHONPATH = .:tests/functional |
337 | +passenv = |
338 | + HOME |
339 | + PATH |
340 | + PYTEST_KEEP_MODEL |
341 | + PYTEST_CLOUD_NAME |
342 | + PYTEST_CLOUD_REGION |
343 | + PYTEST_MODEL |
344 | + MODEL_SETTINGS |
345 | + HTTP_PROXY |
346 | + HTTPS_PROXY |
347 | + NO_PROXY |
348 | + SNAP_HTTP_PROXY |
349 | + SNAP_HTTPS_PROXY |
350 | + OS_* |
351 | |
352 | [testenv:unit] |
353 | deps = .[dev] |
354 | @@ -16,23 +30,12 @@ commands = pytest -v \ |
355 | --cov-report=term \ |
356 | --cov-report=annotate:report/annotated \ |
357 | --cov-report=html:report/html \ |
358 | - tests |
359 | - |
360 | -[testenv:functional] |
361 | -passenv = |
362 | - HOME |
363 | - JUJU_REPOSITORY |
364 | - PATH |
365 | -deps = .[dev] |
366 | -commands = pytest -v --ignore {toxinidir}/tests/unit \ |
367 | - --cov=juju_verify \ |
368 | - --cov-report=term \ |
369 | - --cov-report=annotate:report/annotated \ |
370 | - --cov-report=html:report/html \ |
371 | - tests |
372 | + tests/unit |
373 | |
374 | [testenv:lint] |
375 | -deps = .[dev] |
376 | +deps = |
377 | + .[dev] |
378 | + -r{toxinidir}/tests/functional/requirements.txt |
379 | commands = |
380 | flake8 {toxinidir}/juju_verify/ {toxinidir}/tests/ |
381 | mypy {toxinidir}/juju_verify/ |
382 | @@ -67,3 +70,23 @@ application_import_names = juju_verify |
383 | import-order-style = pep8 |
384 | max-line-length = 89 |
385 | max-complexity = 10 |
386 | + |
387 | + |
388 | +[testenv:func] |
389 | +changedir = {toxinidir}/tests/functional |
390 | +commands = |
391 | + pip install --editable {toxinidir}/ |
392 | + functest-run-suite {posargs} |
393 | +deps = |
394 | + .[dev] |
395 | + -r{toxinidir}/tests/functional/requirements.txt |
396 | + |
397 | + |
398 | +[testenv:func-debug] |
399 | +changedir = {toxinidir}/tests/functional |
400 | +commands = |
401 | + pip install --editable {toxinidir}/ |
402 | + functest-run-suite {posargs} --keep-model --log DEBUG |
403 | +deps = |
404 | + .[dev] |
405 | + -r{toxinidir}/tests/functional/requirements.txt |
This merge proposal is being monitored by mergebot. Change the status to Approved to merge.