Migrate charm-ceph-proxy testing to Zaza

Change-Id: If9e79b22a919997961a23929435450af0883b882
Closes-Bug: #1828424
func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/5
This commit is contained in:
Ramon Grullon 2019-05-28 13:42:30 +00:00
parent f3da11f92b
commit 8e08a9c22a
27 changed files with 432 additions and 336 deletions

View File

@ -7,23 +7,8 @@ mock>=1.2
flake8>=2.2.4,<=2.4.1 flake8>=2.2.4,<=2.4.1
stestr>=2.2.0 stestr>=2.2.0
requests>=2.18.4 requests>=2.18.4
# BEGIN: Amulet OpenStack Charm Helper Requirements
# Liberty client lower constraints
amulet>=1.14.3,<2.0;python_version=='2.7'
bundletester>=0.6.1,<1.0;python_version=='2.7'
python-ceilometerclient>=1.5.0
python-cinderclient>=1.4.0
python-glanceclient>=1.1.0
python-heatclient>=0.8.0
python-keystoneclient>=1.7.1
python-neutronclient>=3.1.0
python-novaclient>=2.30.1
python-openstackclient>=1.7.0
python-swiftclient>=2.6.0
pika>=0.10.0,<1.0
distro-info
git+https://github.com/juju/charm-helpers.git#egg=charmhelpers
# END: Amulet OpenStack Charm Helper Requirements
# NOTE: workaround for 14.04 pip/tox # NOTE: workaround for 14.04 pip/tox
pytz pytz
pyudev # for ceph-* charm unit tests (not mocked?) pyudev # for ceph-* charm unit tests (not mocked?)
git+https://github.com/openstack-charmers/zaza.git@remove-namespaced-tests#egg=zaza;python_version>='3.0'
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack;python_version>='3.0'

View File

@ -1,155 +0,0 @@
#!/usr/bin/env python
import amulet
from charmhelpers.contrib.openstack.amulet.deployment import (
OpenStackAmuletDeployment
)
from charmhelpers.contrib.openstack.amulet.utils import ( # noqa
OpenStackAmuletUtils,
DEBUG,
# ERROR
)
# Use DEBUG to turn on debug logging
u = OpenStackAmuletUtils(DEBUG)
class CephBasicDeployment(OpenStackAmuletDeployment):
"""Amulet tests on a basic ceph deployment."""
def __init__(self, series=None, openstack=None, source=None, stable=False):
"""Deploy the entire test environment."""
super(CephBasicDeployment, self).__init__(series, openstack, source,
stable)
self._add_services()
self._add_relations()
self._configure_services()
self._deploy()
u.log.info('Waiting on extended status checks...')
exclude_services = ['ceph-proxy', 'ceph-radosgw']
# Wait for deployment ready msgs, except exclusions
self._auto_wait_for_status(exclude_services=exclude_services)
self._configure_proxy()
self.d.sentry.wait()
self._initialize_tests()
self._auto_wait_for_status()
def _add_services(self):
"""Add services
Add the services that we're testing, where ceph is local,
and the rest of the service are from lp branches that are
compatible with the local charm (e.g. stable or next).
"""
this_service = {'name': 'ceph-proxy'}
other_services = [{'name': 'ceph-mon', 'units': 3},
{'name': 'ceph-osd', 'units': 3,
'storage': {'osd-devices': 'cinder,10G'}},
{'name': 'ceph-radosgw'}]
super(CephBasicDeployment, self)._add_services(this_service,
other_services)
def _add_relations(self):
"""Add all of the relations for the services."""
relations = {
'ceph-osd:mon': 'ceph-mon:osd',
'ceph-radosgw:mon': 'ceph-proxy:radosgw',
}
super(CephBasicDeployment, self)._add_relations(relations)
def _configure_services(self):
ceph_config = {
'monitor-count': '3',
'auth-supported': 'none',
}
# Include a non-existent device as osd-devices is a whitelist,
# and this will catch cases where proposals attempt to change that.
ceph_osd_config = {
'osd-devices': '/srv/ceph /dev/test-non-existent'
}
proxy_config = {
'source': self.source
}
configs = {'ceph-mon': ceph_config,
'ceph-osd': ceph_osd_config,
'ceph-proxy': proxy_config}
super(CephBasicDeployment, self)._configure_services(configs)
def _configure_proxy(self):
"""Setup CephProxy with Ceph configuration
from running Ceph cluster
"""
mon_key = u.file_contents_safe(
self.d.sentry['ceph-mon'][0],
'/etc/ceph/ceph.client.admin.keyring'
).split(' = ')[-1].rstrip()
ceph_ips = []
for x in self.d.sentry['ceph-mon']:
output, code = x.run("unit-get private-address")
ceph_ips.append(output + ':6789')
proxy_config = {
'auth-supported': 'none',
'admin-key': mon_key,
'fsid': '6547bd3e-1397-11e2-82e5-53567c8d32dc',
'monitor-hosts': ' '.join(ceph_ips)
}
u.log.debug('Config: {}'.format(proxy_config))
self.d.configure('ceph-proxy', proxy_config)
def _initialize_tests(self):
"""Perform final initialization before tests get run."""
# Access the sentries for inspecting service units
self.ceph_osd_sentry = self.d.sentry['ceph-osd'][0]
self.ceph0_sentry = self.d.sentry['ceph-mon'][0]
self.radosgw_sentry = self.d.sentry['ceph-radosgw'][0]
self.proxy_sentry = self.d.sentry['ceph-proxy'][0]
u.log.debug('openstack release val: {}'.format(
self._get_openstack_release()))
u.log.debug('openstack release str: {}'.format(
self._get_openstack_release_string()))
def test_100_ceph_processes(self):
"""Verify that the expected service processes are running
on each ceph unit."""
# Process name and quantity of processes to expect on each unit
ceph_processes = {
'ceph-mon': 1,
}
# Units with process names and PID quantities expected
expected_processes = {
self.ceph0_sentry: ceph_processes
}
actual_pids = u.get_unit_process_ids(expected_processes)
ret = u.validate_unit_process_ids(expected_processes, actual_pids)
if ret:
amulet.raise_status(amulet.FAIL, msg=ret)
def test_499_ceph_cmds_exit_zero(self):
"""Check basic functionality of ceph cli commands against
ceph proxy units."""
sentry_units = [
self.proxy_sentry,
self.ceph0_sentry
]
commands = [
'sudo ceph health',
'sudo ceph mds stat',
'sudo ceph pg stat',
'sudo ceph osd stat',
'sudo ceph mon stat',
]
ret = u.check_commands_on_units(commands, sentry_units)
if ret:
amulet.raise_status(amulet.FAIL, msg=ret)

View File

@ -0,0 +1,23 @@
series: bionic
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: bionic
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:bionic-rocky
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:bionic-rocky
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:bionic-rocky
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: cloud:bionic-rocky
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: bionic
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:bionic-stein
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:bionic-stein
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:bionic-stein
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: cloud:bionic-stein
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,26 @@
series: trusty
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: trusty
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:trusty-juno
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:trusty-juno
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:trusty-juno
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: cloud:trusty-juno
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: trusty
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:trusty-kilo
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:trusty-kilo
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:trusty-kilo
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: cloud:trusty-kilo
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: trusty
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:trusty-liberty
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:trusty-liberty
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:trusty-liberty
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: cloud:trusty-liberty
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: trusty
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:trusty-mitaka
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:trusty-mitaka
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:trusty-mitaka
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: trusty-mitaka
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,26 @@
series: xenial
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: xenial
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:xenial-newton
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:xenial-newton
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:xenial-newton
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: cloud:xenial-newton
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: xenial
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:xenial-ocata
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:xenial-ocata
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:xenial-ocata
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: xenial-ocata
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: bionic
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:xenial-pike
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:xenial-pike
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:xenial-pike
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: xenial-pike
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -0,0 +1,30 @@
series: xenial
applications:
ceph-mon:
charm: 'cs:~openstack-charmers-next/ceph-mon'
num_units: 3
options:
expected-osd-count: 3
source: cloud:xenial-queens
ceph-osd:
charm: 'cs:~openstack-charmers-next/ceph-osd'
num_units: 3
storage:
osd-devices: 10G
options:
source: cloud:xenial-queens
ceph-proxy:
charm: 'ceph-proxy'
num_units: 1
options:
source: cloud:xenial-queens
ceph-radosgw:
charm: 'cs:~openstack-charmers-next/ceph-radosgw'
num_units: 1
options:
source: xenial-queens
relations:
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceph-proxy:radosgw'
- 'ceph-radosgw:mon'

View File

@ -1,9 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on cosmic-rocky."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='cosmic')
deployment.run_tests()

View File

@ -1,9 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on disco-stein."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='disco')
deployment.run_tests()

View File

@ -1,9 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on bionic-queens."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='bionic')
deployment.run_tests()

View File

@ -1,11 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on bionic-rocky."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='bionic',
openstack='cloud:bionic-rocky',
source='cloud:bionic-updates/rocky')
deployment.run_tests()

View File

@ -1,11 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on bionic-stein."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='bionic',
openstack='cloud:bionic-stein',
source='cloud:bionic-stein')
deployment.run_tests()

View File

@ -1,11 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on trusty-mitaka."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='trusty',
openstack='cloud:trusty-mitaka',
source='cloud:trusty-updates/mitaka')
deployment.run_tests()

View File

@ -1,9 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on xenial-mitaka."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='xenial')
deployment.run_tests()

View File

@ -1,11 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on xenial-ocata."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='xenial',
openstack='cloud:xenial-ocata',
source='cloud:xenial-updates/ocata')
deployment.run_tests()

View File

@ -1,11 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on xenial-pike."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='xenial',
openstack='cloud:xenial-pike',
source='cloud:xenial-updates/pike')
deployment.run_tests()

View File

@ -1,11 +0,0 @@
#!/usr/bin/env python
"""Amulet tests on a basic ceph deployment on xenial-queens."""
from basic_deployment import CephBasicDeployment
if __name__ == '__main__':
deployment = CephBasicDeployment(series='xenial',
openstack='cloud:xenial-queens',
source='cloud:xenial-updates/queens')
deployment.run_tests()

View File

@ -1,18 +1,38 @@
# Bootstrap the model if necessary. configure:
bootstrap: True - zaza.openstack.configure.ceph_proxy.setup_ceph_proxy
# Re-use bootstrap node.
reset: True tests:
# Use tox/requirements to drive the venv instead of bundletester's venv feature. - zaza.openstack.charm_tests.ceph.tests.CephProxyTest
virtualenv: False
# Leave makefile empty, otherwise unit/lint tests will rerun ahead of amulet. gate_bundles:
makefile: [] - trusty-mitaka # jewel
# Do not specify juju PPA sources. Juju is presumed to be pre-installed - xenial-mitaka # jewel
# and configured in all test runner environments. - xenial-queens # luminous
#sources: - bionic-queens # luminous
# Do not specify or rely on system packages. - bionic-rocky # mimic
#packages: dev_bundles:
# Do not specify python packages here. Use test-requirements.txt # Icehouse
# and tox instead. ie. The venv is constructed before bundletester - trusty-icehouse
# is invoked. - trusty-juno
#python-packages: # Hammer
reset_timeout: 600 - trusty-kilo
- trusty-liberty
# Jewel
- xenial-newton
- xenial-ocata
# Pike
- xenial-pike
# Mimic
- bionic-stein
smoke_bundles:
- bionic-queens
target_deploy_status:
ceph-proxy:
workload-status: blocked
workload-status-message: Ensure FSID and admin-key are set
ceph-radosgw:
workload-status: blocked
workload-status-message: "Missing relations: mon"

61
tox.ini
View File

@ -15,6 +15,8 @@ install_command =
commands = stestr run {posargs} commands = stestr run {posargs}
whitelist_externals = juju whitelist_externals = juju
passenv = HOME TERM AMULET_* CS_API_* passenv = HOME TERM AMULET_* CS_API_*
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:py27] [testenv:py27]
basepython = python2.7 basepython = python2.7
@ -43,50 +45,21 @@ commands = flake8 {posargs} hooks unit_tests tests actions lib
basepython = python3 basepython = python3
commands = {posargs} commands = {posargs}
[testenv:func27-noop]
# DRY RUN - For Debug
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 "gate-*" -n --no-destroy
[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
commands =
bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" --no-destroy
[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
commands =
bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic-queens --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
[flake8] [flake8]
ignore = E402,E226 ignore = E402,E226
exclude = */charmhelpers exclude = */charmhelpers
[testenv:func]
basepython = python3
commands =
functest-run-suite --keep-model
[testenv:func-smoke]
basepython = python3
commands =
functest-run-suite --keep-model --smoke
[testenv:func-dev]
basepython = python3
commands =
functest-run-suite --keep-model --dev