From 257c58f373975f8a21d7f4dc5fc1c11317cc70a2 Mon Sep 17 00:00:00 2001 From: David Ames Date: Fri, 12 Jul 2019 16:20:43 -0700 Subject: [PATCH] Convert percona-cluster to Zaza Convert amulet tests to zaza. Add additional tests for new cold boot actions. Use multi-model tests.yaml for different tests for bionic and xenial. Change-Id: I5dadefa6092acecdaae194370a81b05a69b09909 --- test-requirements.txt | 3 ++ tests/bundles/bionic-ha.yaml | 1 + tests/bundles/bionic.yaml | 14 ++++++ tests/bundles/disco-ha.yaml | 1 + tests/bundles/disco.yaml | 14 ++++++ tests/bundles/overlays/bionic-ha.yaml | 1 + tests/bundles/overlays/disco-ha.yaml | 1 + tests/bundles/overlays/ha.yaml | 14 ++++++ .../overlays/local-charm-overlay.yaml.j2 | 21 ++++++++ tests/bundles/overlays/xenial-ha.yaml | 1 + tests/bundles/xenial-ha.yaml | 1 + tests/bundles/xenial.yaml | 14 ++++++ tests/tests.yaml | 38 +++++++------- tox.ini | 49 ++++--------------- 14 files changed, 116 insertions(+), 57 deletions(-) create mode 120000 tests/bundles/bionic-ha.yaml create mode 100644 tests/bundles/bionic.yaml create mode 120000 tests/bundles/disco-ha.yaml create mode 100644 tests/bundles/disco.yaml create mode 120000 tests/bundles/overlays/bionic-ha.yaml create mode 120000 tests/bundles/overlays/disco-ha.yaml create mode 100644 tests/bundles/overlays/ha.yaml create mode 100644 tests/bundles/overlays/local-charm-overlay.yaml.j2 create mode 120000 tests/bundles/overlays/xenial-ha.yaml create mode 120000 tests/bundles/xenial-ha.yaml create mode 100644 tests/bundles/xenial.yaml diff --git a/test-requirements.txt b/test-requirements.txt index 272ce1d..e4b5b1e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -27,3 +27,6 @@ git+https://github.com/juju/charm-helpers.git#egg=charmhelpers # NOTE: workaround for 14.04 pip/tox pytz pyudev # for ceph-* charm unit tests (not mocked?) +git+https://github.com/openstack-charmers/zaza.git#egg=zaza;python_version>='3.0' +git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack + diff --git a/tests/bundles/bionic-ha.yaml b/tests/bundles/bionic-ha.yaml new file mode 120000 index 0000000..3698a27 --- /dev/null +++ b/tests/bundles/bionic-ha.yaml @@ -0,0 +1 @@ +bionic.yaml \ No newline at end of file diff --git a/tests/bundles/bionic.yaml b/tests/bundles/bionic.yaml new file mode 100644 index 0000000..e887743 --- /dev/null +++ b/tests/bundles/bionic.yaml @@ -0,0 +1,14 @@ +series: bionic +relations: +- - keystone:shared-db + - percona-cluster:shared-db +applications: + percona-cluster: + series: bionic + charm: ../../../percona-cluster + num_units: 1 + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + token-expiration: 60 diff --git a/tests/bundles/disco-ha.yaml b/tests/bundles/disco-ha.yaml new file mode 120000 index 0000000..06abc05 --- /dev/null +++ b/tests/bundles/disco-ha.yaml @@ -0,0 +1 @@ +disco.yaml \ No newline at end of file diff --git a/tests/bundles/disco.yaml b/tests/bundles/disco.yaml new file mode 100644 index 0000000..056ce40 --- /dev/null +++ b/tests/bundles/disco.yaml @@ -0,0 +1,14 @@ +series: disco +relations: +- - keystone:shared-db + - percona-cluster:shared-db +applications: + percona-cluster: + series: disco + charm: ../../../percona-cluster + num_units: 1 + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + token-expiration: 60 diff --git a/tests/bundles/overlays/bionic-ha.yaml b/tests/bundles/overlays/bionic-ha.yaml new file mode 120000 index 0000000..8ba59d0 --- /dev/null +++ b/tests/bundles/overlays/bionic-ha.yaml @@ -0,0 +1 @@ +ha.yaml \ No newline at end of file diff --git a/tests/bundles/overlays/disco-ha.yaml b/tests/bundles/overlays/disco-ha.yaml new file mode 120000 index 0000000..8ba59d0 --- /dev/null +++ b/tests/bundles/overlays/disco-ha.yaml @@ -0,0 +1 @@ +ha.yaml \ No newline at end of file diff --git a/tests/bundles/overlays/ha.yaml b/tests/bundles/overlays/ha.yaml new file mode 100644 index 0000000..22faf0b --- /dev/null +++ b/tests/bundles/overlays/ha.yaml @@ -0,0 +1,14 @@ +relations: +- - percona-cluster + - hacluster + +applications: + percona-cluster: + num_units: 3 + options: + min-cluster-size: 3 + hacluster: + charm: cs:~openstack-charmers-next/hacluster + num_units: 0 + options: + cluster_count: 3 diff --git a/tests/bundles/overlays/local-charm-overlay.yaml.j2 b/tests/bundles/overlays/local-charm-overlay.yaml.j2 new file mode 100644 index 0000000..bdb3dfc --- /dev/null +++ b/tests/bundles/overlays/local-charm-overlay.yaml.j2 @@ -0,0 +1,21 @@ +#applications: +# percona-cluster: +# options: +# vip: {{ OS_VIP00 }} + + +relations: +- - percona-cluster + - hacluster + +applications: + percona-cluster: + num_units: 3 + options: + vip: {{ OS_VIP00 }} + min-cluster-size: 3 + hacluster: + charm: cs:~openstack-charmers-next/hacluster + num_units: 0 + options: + cluster_count: 3 diff --git a/tests/bundles/overlays/xenial-ha.yaml b/tests/bundles/overlays/xenial-ha.yaml new file mode 120000 index 0000000..8ba59d0 --- /dev/null +++ b/tests/bundles/overlays/xenial-ha.yaml @@ -0,0 +1 @@ +ha.yaml \ No newline at end of file diff --git a/tests/bundles/xenial-ha.yaml b/tests/bundles/xenial-ha.yaml new file mode 120000 index 0000000..7f07a7e --- /dev/null +++ b/tests/bundles/xenial-ha.yaml @@ -0,0 +1 @@ +xenial.yaml \ No newline at end of file diff --git a/tests/bundles/xenial.yaml b/tests/bundles/xenial.yaml new file mode 100644 index 0000000..a0575c6 --- /dev/null +++ b/tests/bundles/xenial.yaml @@ -0,0 +1,14 @@ +series: xenial +relations: +- - keystone:shared-db + - percona-cluster:shared-db +applications: + percona-cluster: + series: xenial + charm: ../../../percona-cluster + num_units: 1 + keystone: + charm: cs:~openstack-charmers-next/keystone + num_units: 1 + options: + token-expiration: 60 diff --git a/tests/tests.yaml b/tests/tests.yaml index a03e7ba..d922de0 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -1,18 +1,20 @@ -# Bootstrap the model if necessary. -bootstrap: True -# Re-use bootstrap node. -reset: True -# Use tox/requirements to drive the venv instead of bundletester's venv feature. -virtualenv: False -# Leave makefile empty, otherwise unit/lint tests will rerun ahead of amulet. -makefile: [] -# Do not specify juju PPA sources. Juju is presumed to be pre-installed -# and configured in all test runner environments. -#sources: -# Do not specify or rely on system packages. -#packages: -# Do not specify python packages here. Use test-requirements.txt -# and tox instead. ie. The venv is constructed before bundletester -# is invoked. -#python-packages: -reset_timeout: 600 +charm_name: "percona-cluster" +tests: + - bionic_model: + - zaza.openstack.charm_tests.mysql.tests.PerconaClusterColdStartTest + - zaza.openstack.charm_tests.mysql.tests.PerconaClusterCharmTests + - zaza.openstack.charm_tests.mysql.tests.PerconaClusterScaleTests + - xenial_model: + - zaza.openstack.charm_tests.mysql.tests.PerconaClusterCharmTests + - zaza.openstack.charm_tests.mysql.tests.PerconaClusterScaleTests +configure: + - zaza.model.block_until_all_units_idle +target_deploy_status: +gate_bundles: + - bionic_model: bionic-ha + - xenial_model: xenial-ha +# Disco disabled until hacluster issues are resolved. +# - disco-ha +smoke_bundles: + - bionic_model: bionic-ha +dev_bundles: diff --git a/tox.ini b/tox.ini index 633f046..81e6bcb 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ install_command = pip install {opts} {packages} commands = stestr run {posargs} whitelist_externals = juju -passenv = HOME TERM AMULET_* CS_API_* +passenv = HOME TERM AMULET_* CS_API_* OS_* deps = -r{toxinidir}/test-requirements.txt [testenv:py35] @@ -71,49 +71,20 @@ omit = basepython = python3 commands = {posargs} -[testenv:func27-noop] -# DRY RUN - For Debug -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +[testenv:func] +basepython = python3 commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" -n --no-destroy + functest-run-suite --keep-model -[testenv:func27] -# Charm Functional Test -# Run all gate tests which are +x (expected to always pass) -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +[testenv:func-smoke] +basepython = python3 commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" --no-destroy + functest-run-suite --keep-model --smoke -[testenv:func27-smoke] -# Charm Functional Test -# Run a specific test as an Amulet smoke test (expected to always pass) -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +[testenv:func-dev] +basepython = python3 commands = - bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic --no-destroy - -[testenv:func27-dfs] -# Charm Functional Test -# Run all deploy-from-source tests which are +x (may not always pass!) -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dfs-*" --no-destroy - -[testenv:func27-dev] -# Charm Functional Test -# Run all development test targets which are +x (may not always pass!) -basepython = python2.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt -commands = - bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dev-*" --no-destroy + functest-run-suite --keep-model --dev [flake8] ignore = E402,E226