Porting tests from Amulet to Zaza

Closes-Bug: #1828424

Change-Id: Iab72ea5d2bd06a99e0df1af1e419dc4b31e1a99e
This commit is contained in:
Aurelien Lourot 2020-03-06 10:07:56 +01:00
parent 23a9899237
commit 54bfb99b8f
22 changed files with 940 additions and 485 deletions

View File

@ -1,33 +1,8 @@
# This file is managed centrally. If you find the need to modify this as a
# one-off, please don't. Intead, consult #openstack-charms and ask about
# requirements management in charms via bot-control. Thank you.
charm-tools>=2.4.4
coverage>=3.6
mock>=1.2
flake8>=2.2.4,<=2.4.1
stestr>=2.2.0
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'
aodhclient>=0.1.0
gnocchiclient>=3.1.0,<3.2.0
python-barbicanclient>=4.0.1
python-ceilometerclient>=1.5.0
python-cinderclient>=1.4.0,<5.0.0
python-designateclient>=1.5
python-glanceclient>=1.1.0
python-heatclient>=0.8.0
python-keystoneclient>=1.7.1
python-manilaclient>=1.8.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
pytz # workaround for 14.04 pip/tox
pyudev # for ceph-* charm unit tests (not mocked?)
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of *requirements.txt files for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
#
# Functional Test Requirements (let Zaza's dependencies solve all dependencies here!)
git+https://github.com/openstack-charmers/zaza.git#egg=zaza
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack

View File

@ -1,6 +1,6 @@
# Overview
This directory provides Amulet tests to verify basic deployment functionality
This directory provides Zaza tests to verify basic deployment functionality
from the perspective of this charm, its requirements and its features, as
exercised in a subset of the full OpenStack deployment test bundle topology.

View File

@ -1,247 +0,0 @@
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import amulet
import json
import subprocess
import time
import charmhelpers.contrib.openstack.amulet.deployment as amulet_deployment
import charmhelpers.contrib.openstack.amulet.utils as os_amulet_utils
from gnocchiclient.v1 import client as gnocchi_client
# Use DEBUG to turn on debug logging
u = os_amulet_utils.OpenStackAmuletUtils(os_amulet_utils.DEBUG)
class GnocchiCharmDeployment(amulet_deployment.OpenStackAmuletDeployment):
"""Amulet tests on a basic gnocchi deployment."""
gnocchi_svcs = ['haproxy', 'gnocchi-metricd', 'apache2']
gnocchi_proc_names = gnocchi_svcs
no_origin = ['memcached', 'percona-cluster', 'rabbitmq-server',
'ceph-mon', 'ceph-osd']
def __init__(self, series, openstack=None, source=None, stable=False,
snap_source=None):
"""Deploy the entire test environment."""
super(GnocchiCharmDeployment, self).__init__(series, openstack,
source, stable)
self.snap_source = snap_source
self._add_services()
self._add_relations()
self._configure_services()
self._deploy()
u.log.info('Waiting on extended status checks...')
self.exclude_services = ['mysql', 'mongodb', 'memcached']
# Ceilometer will come up blocked until the ceilometer-upgrade
# action is run
self.exclude_services.append("ceilometer")
self._auto_wait_for_status(exclude_services=self.exclude_services)
self._initialize_tests()
self.run_ceilometer_upgrade_action()
def _add_services(self):
"""Add services
Add the services that we're testing, where gnocchi 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': 'gnocchi'}
other_services = [
{'name': 'percona-cluster'},
{'name': 'ceilometer'},
{'name': 'keystone'},
{'name': 'rabbitmq-server'},
{'name': 'memcached', 'location': 'cs:memcached'},
{'name': 'ceph-mon', 'units': 3},
{'name': 'ceph-osd', 'units': 3,
'storage': {'osd-devices': 'cinder,10G'}},
]
if self._get_openstack_release() < self.xenial_queens:
other_services.append({'name': 'mongodb'})
super(GnocchiCharmDeployment, self)._add_services(
this_service,
other_services,
no_origin=self.no_origin
)
def _add_relations(self):
"""Add all of the relations for the services."""
relations = {
'keystone:shared-db': 'percona-cluster:shared-db',
'gnocchi:identity-service': 'keystone:identity-service',
'gnocchi:shared-db': 'percona-cluster:shared-db',
'gnocchi:storage-ceph': 'ceph-mon:client',
'gnocchi:metric-service': 'ceilometer:metric-service',
'gnocchi:coordinator-memcached': 'memcached:cache',
'ceilometer:amqp': 'rabbitmq-server:amqp',
'ceph-mon:osd': 'ceph-osd:mon',
}
if self._get_openstack_release() >= self.xenial_queens:
relations['ceilometer:identity-credentials'] = \
'keystone:identity-credentials'
else:
relations['ceilometer:identity-service'] = \
'keystone:identity-service'
relations['ceilometer:shared-db'] = 'mongodb:database'
super(GnocchiCharmDeployment, self)._add_relations(relations)
def _configure_services(self):
"""Configure all of the services."""
keystone_config = {'admin-password': 'openstack',
'admin-token': 'ubuntutesting'}
gnocchi_config = {}
if self.snap_source:
gnocchi_config['openstack-origin'] = self.snap_source
elif self.series == 'bionic' and self.openstack is None:
# pending release of LP: #1813582
gnocchi_config['openstack-origin'] = 'distro-proposed'
configs = {'keystone': keystone_config,
'gnocchi': gnocchi_config}
super(GnocchiCharmDeployment, self)._configure_services(configs)
def _get_token(self):
return self.keystone.service_catalog.catalog['token']['id']
def _initialize_tests(self):
"""Perform final initialization before tests get run."""
# Access the sentries for inspecting service units
self.gnocchi_sentry = self.d.sentry['gnocchi'][0]
self.mysql_sentry = self.d.sentry['percona-cluster'][0]
self.keystone_sentry = self.d.sentry['keystone'][0]
self.ceil_sentry = self.d.sentry['ceilometer'][0]
# Authenticate admin with keystone endpoint
self.keystone_session, self.keystone = u.get_default_keystone_session(
self.keystone_sentry,
openstack_release=self._get_openstack_release())
# Authenticate admin with gnocchi endpoint
gnocchi_ep = self.keystone.service_catalog.url_for(
service_type='metric',
interface='publicURL')
self.gnocchi = gnocchi_client.Client(session=self.keystone_session,
endpoint_override=gnocchi_ep)
def check_and_wait(self, check_command, interval=2, max_wait=200,
desc=None):
waited = 0
while not check_command() or waited > max_wait:
if desc:
u.log.debug(desc)
time.sleep(interval)
waited = waited + interval
if waited > max_wait:
raise Exception('cmd failed {}'.format(check_command))
def _run_action(self, unit_id, action, *args):
command = ["juju", "action", "do", "--format=json", unit_id, action]
command.extend(args)
output = subprocess.check_output(command)
output_json = output.decode(encoding="UTF-8")
data = json.loads(output_json)
action_id = data[u'Action queued with id']
return action_id
def _wait_on_action(self, action_id):
command = ["juju", "action", "fetch", "--format=json", action_id]
while True:
try:
output = subprocess.check_output(command)
except Exception as e:
print(e)
return False
output_json = output.decode(encoding="UTF-8")
data = json.loads(output_json)
if data[u"status"] == "completed":
return True
elif data[u"status"] == "failed":
return False
time.sleep(2)
def run_ceilometer_upgrade_action(self):
"""Run ceilometer-upgrade
This action will be run early to initialize ceilometer
when gnocchi is related.
Ceilometer will be in a blocked state until this runs.
"""
u.log.debug('Checking ceilometer-upgrade')
unit = self.ceil_sentry
action_id = unit.run_action("ceilometer-upgrade")
assert u.wait_on_action(action_id), "ceilometer-upgrade action failed"
# Wait for acivte Unit is ready on ceilometer
self.exclude_services.remove('ceilometer')
self._auto_wait_for_status(exclude_services=self.exclude_services)
u.log.debug('OK')
def test_100_services(self):
"""Verify the expected services are running on the corresponding
service units."""
u.log.debug('Checking system services on units...')
service_names = {
self.gnocchi_sentry: self.gnocchi_svcs,
}
ret = u.validate_services_by_name(service_names)
if ret:
amulet.raise_status(amulet.FAIL, msg=ret)
u.log.debug('OK')
def test_200_api_connection(self):
"""Simple api calls to check service is up and responding"""
u.log.debug('Checking api functionality...')
assert(self.gnocchi.status.get() != [])
u.log.debug('OK')
def _assert_services(self, should_run):
services = self.gnocchi_proc_names
u.get_unit_process_ids(
{self.gnocchi_sentry: services},
expect_success=should_run)
def test_910_pause_and_resume(self):
"""The services can be paused and resumed. """
self._assert_services(should_run=True)
action_id = u.run_action(self.gnocchi_sentry, "pause")
assert u.wait_on_action(action_id), "Pause action failed."
self._assert_services(should_run=False)
action_id = u.run_action(self.gnocchi_sentry, "resume")
assert u.wait_on_action(action_id), "Resume action failed"
self._assert_services(should_run=True)
class GnocchiCharmSnapDeployment(GnocchiCharmDeployment):
"""Amulet tests on a snap based gnocchi deployment."""
gnocchi_svcs = ['haproxy', 'snap.gnocchi.metricd',
'snap.gnocchi.uwsgi',
'snap.gnocchi.nginx']
gnocchi_proc_names = ['haproxy', 'gnocchi-metricd', 'uwsgi', 'nginx']

View File

@ -0,0 +1,107 @@
variables:
openstack-origin: &openstack-origin distro
series: &series bionic
machines:
0:
constraints: "mem=3072M"
1: {}
2: {}
3: {}
4: {}
5: {}
6: {}
7: {}
8: {}
9: {}
10: {}
11: {}
# We specify machine placements for these to improve iteration
# time, given that machine "0" comes up way before machine "6"
applications:
percona-cluster:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
options:
source: *openstack-origin
to:
- '0'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '1'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '2'
ceilometer:
charm: cs:~openstack-charmers-next/ceilometer
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '3'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
num_units: 3
storage:
osd-devices: 'cinder,10G'
options:
source: *openstack-origin
to:
- '4'
- '5'
- '6'
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
num_units: 3
options:
expected-osd-count: 3
monitor-count: '3'
source: *openstack-origin
to:
- '7'
- '8'
- '9'
gnocchi:
series: *series
charm: cs:gnocchi
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '10'
memcached:
charm: cs:~memcached-team/memcached
num_units: 1
to:
- '11'
relations:
- - 'keystone:shared-db'
- 'percona-cluster:shared-db'
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceilometer:amqp'
- 'rabbitmq-server:amqp'
- - 'ceilometer:identity-credentials'
- 'keystone:identity-credentials'
- - 'ceilometer:identity-notifications'
- 'keystone:identity-notifications'
- - 'ceilometer:metric-service'
- 'gnocchi:metric-service'
- - 'gnocchi:identity-service'
- 'keystone:identity-service'
- - 'gnocchi:shared-db'
- 'percona-cluster:shared-db'
- - 'gnocchi:storage-ceph'
- 'ceph-mon:client'
- - 'gnocchi:coordinator-memcached'
- 'memcached:cache'

View File

@ -0,0 +1,107 @@
variables:
openstack-origin: &openstack-origin cloud:bionic-rocky
series: &series bionic
machines:
0:
constraints: "mem=3072M"
1: {}
2: {}
3: {}
4: {}
5: {}
6: {}
7: {}
8: {}
9: {}
10: {}
11: {}
# We specify machine placements for these to improve iteration
# time, given that machine "0" comes up way before machine "6"
applications:
percona-cluster:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
options:
source: *openstack-origin
to:
- '0'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '1'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '2'
ceilometer:
charm: cs:~openstack-charmers-next/ceilometer
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '3'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
num_units: 3
storage:
osd-devices: 'cinder,10G'
options:
source: *openstack-origin
to:
- '4'
- '5'
- '6'
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
num_units: 3
options:
expected-osd-count: 3
monitor-count: '3'
source: *openstack-origin
to:
- '7'
- '8'
- '9'
gnocchi:
series: *series
charm: cs:gnocchi
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '10'
memcached:
charm: cs:~memcached-team/memcached
num_units: 1
to:
- '11'
relations:
- - 'keystone:shared-db'
- 'percona-cluster:shared-db'
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceilometer:amqp'
- 'rabbitmq-server:amqp'
- - 'ceilometer:identity-credentials'
- 'keystone:identity-credentials'
- - 'ceilometer:identity-notifications'
- 'keystone:identity-notifications'
- - 'ceilometer:metric-service'
- 'gnocchi:metric-service'
- - 'gnocchi:identity-service'
- 'keystone:identity-service'
- - 'gnocchi:shared-db'
- 'percona-cluster:shared-db'
- - 'gnocchi:storage-ceph'
- 'ceph-mon:client'
- - 'gnocchi:coordinator-memcached'
- 'memcached:cache'

View File

@ -0,0 +1,107 @@
variables:
openstack-origin: &openstack-origin cloud:bionic-stein
series: &series bionic
machines:
0:
constraints: "mem=3072M"
1: {}
2: {}
3: {}
4: {}
5: {}
6: {}
7: {}
8: {}
9: {}
10: {}
11: {}
# We specify machine placements for these to improve iteration
# time, given that machine "0" comes up way before machine "6"
applications:
percona-cluster:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
options:
source: *openstack-origin
to:
- '0'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '1'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '2'
ceilometer:
charm: cs:~openstack-charmers-next/ceilometer
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '3'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
num_units: 3
storage:
osd-devices: 'cinder,10G'
options:
source: *openstack-origin
to:
- '4'
- '5'
- '6'
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
num_units: 3
options:
expected-osd-count: 3
monitor-count: '3'
source: *openstack-origin
to:
- '7'
- '8'
- '9'
gnocchi:
series: *series
charm: cs:gnocchi
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '10'
memcached:
charm: cs:~memcached-team/memcached
num_units: 1
to:
- '11'
relations:
- - 'keystone:shared-db'
- 'percona-cluster:shared-db'
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceilometer:amqp'
- 'rabbitmq-server:amqp'
- - 'ceilometer:identity-credentials'
- 'keystone:identity-credentials'
- - 'ceilometer:identity-notifications'
- 'keystone:identity-notifications'
- - 'ceilometer:metric-service'
- 'gnocchi:metric-service'
- - 'gnocchi:identity-service'
- 'keystone:identity-service'
- - 'gnocchi:shared-db'
- 'percona-cluster:shared-db'
- - 'gnocchi:storage-ceph'
- 'ceph-mon:client'
- - 'gnocchi:coordinator-memcached'
- 'memcached:cache'

View File

@ -0,0 +1,107 @@
variables:
openstack-origin: &openstack-origin cloud:bionic-train
series: &series bionic
machines:
0:
constraints: "mem=3072M"
1: {}
2: {}
3: {}
4: {}
5: {}
6: {}
7: {}
8: {}
9: {}
10: {}
11: {}
# We specify machine placements for these to improve iteration
# time, given that machine "0" comes up way before machine "6"
applications:
percona-cluster:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
options:
source: *openstack-origin
to:
- '0'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '1'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '2'
ceilometer:
charm: cs:~openstack-charmers-next/ceilometer
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '3'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
num_units: 3
storage:
osd-devices: 'cinder,10G'
options:
source: *openstack-origin
to:
- '4'
- '5'
- '6'
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
num_units: 3
options:
expected-osd-count: 3
monitor-count: '3'
source: *openstack-origin
to:
- '7'
- '8'
- '9'
gnocchi:
series: *series
charm: cs:gnocchi
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '10'
memcached:
charm: cs:~memcached-team/memcached
num_units: 1
to:
- '11'
relations:
- - 'keystone:shared-db'
- 'percona-cluster:shared-db'
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceilometer:amqp'
- 'rabbitmq-server:amqp'
- - 'ceilometer:identity-credentials'
- 'keystone:identity-credentials'
- - 'ceilometer:identity-notifications'
- 'keystone:identity-notifications'
- - 'ceilometer:metric-service'
- 'gnocchi:metric-service'
- - 'gnocchi:identity-service'
- 'keystone:identity-service'
- - 'gnocchi:shared-db'
- 'percona-cluster:shared-db'
- - 'gnocchi:storage-ceph'
- 'ceph-mon:client'
- - 'gnocchi:coordinator-memcached'
- 'memcached:cache'

View File

@ -0,0 +1,107 @@
variables:
openstack-origin: &openstack-origin distro
series: &series eoan
machines:
0:
constraints: "mem=3072M"
1: {}
2: {}
3: {}
4: {}
5: {}
6: {}
7: {}
8: {}
9: {}
10: {}
11: {}
# We specify machine placements for these to improve iteration
# time, given that machine "0" comes up way before machine "6"
applications:
percona-cluster:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
options:
source: *openstack-origin
to:
- '0'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '1'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '2'
ceilometer:
charm: cs:~openstack-charmers-next/ceilometer
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '3'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
num_units: 3
storage:
osd-devices: 'cinder,10G'
options:
source: *openstack-origin
to:
- '4'
- '5'
- '6'
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
num_units: 3
options:
expected-osd-count: 3
monitor-count: '3'
source: *openstack-origin
to:
- '7'
- '8'
- '9'
gnocchi:
series: *series
charm: cs:gnocchi
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '10'
memcached:
charm: cs:~memcached-team/memcached
num_units: 1
to:
- '11'
relations:
- - 'keystone:shared-db'
- 'percona-cluster:shared-db'
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceilometer:amqp'
- 'rabbitmq-server:amqp'
- - 'ceilometer:identity-credentials'
- 'keystone:identity-credentials'
- - 'ceilometer:identity-notifications'
- 'keystone:identity-notifications'
- - 'ceilometer:metric-service'
- 'gnocchi:metric-service'
- - 'gnocchi:identity-service'
- 'keystone:identity-service'
- - 'gnocchi:shared-db'
- 'percona-cluster:shared-db'
- - 'gnocchi:storage-ceph'
- 'ceph-mon:client'
- - 'gnocchi:coordinator-memcached'
- 'memcached:cache'

View File

@ -0,0 +1,117 @@
variables:
openstack-origin: &openstack-origin cloud:xenial-ocata
series: &series xenial
machines:
0:
constraints: "mem=3072M"
1: {}
2: {}
3: {}
4: {}
5: {}
6: {}
7: {}
8: {}
9: {}
10: {}
11: {}
12: {}
# We specify machine placements for these to improve iteration
# time, given that machine "0" comes up way before machine "6"
applications:
percona-cluster:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
options:
source: *openstack-origin
to:
- '0'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '1'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '2'
ceilometer:
charm: cs:~openstack-charmers-next/ceilometer
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '3'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
num_units: 3
storage:
osd-devices: 'cinder,10G'
options:
source: *openstack-origin
to:
- '4'
- '5'
- '6'
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
num_units: 3
options:
expected-osd-count: 3
monitor-count: '3'
source: *openstack-origin
to:
- '7'
- '8'
- '9'
gnocchi:
series: *series
charm: cs:gnocchi
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '10'
memcached:
charm: cs:~memcached-team/memcached
num_units: 1
to:
- '11'
mongodb:
charm: cs:mongodb
num_units: 1
to:
- '12'
relations:
- - 'keystone:shared-db'
- 'percona-cluster:shared-db'
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceilometer:amqp'
- 'rabbitmq-server:amqp'
- - 'ceilometer:identity-credentials'
- 'keystone:identity-credentials'
- - 'ceilometer:identity-notifications'
- 'keystone:identity-notifications'
- - 'ceilometer:shared-db'
- 'mongodb:database'
- - 'ceilometer:identity-service'
- 'keystone:identity-service'
- - 'ceilometer:metric-service'
- 'gnocchi:metric-service'
- - 'gnocchi:identity-service'
- 'keystone:identity-service'
- - 'gnocchi:shared-db'
- 'percona-cluster:shared-db'
- - 'gnocchi:storage-ceph'
- 'ceph-mon:client'
- - 'gnocchi:coordinator-memcached'
- 'memcached:cache'

View File

@ -0,0 +1,117 @@
variables:
openstack-origin: &openstack-origin cloud:xenial-pike
series: &series xenial
machines:
0:
constraints: "mem=3072M"
1: {}
2: {}
3: {}
4: {}
5: {}
6: {}
7: {}
8: {}
9: {}
10: {}
11: {}
12: {}
# We specify machine placements for these to improve iteration
# time, given that machine "0" comes up way before machine "6"
applications:
percona-cluster:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
options:
source: *openstack-origin
to:
- '0'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '1'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '2'
ceilometer:
charm: cs:~openstack-charmers-next/ceilometer
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '3'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
num_units: 3
storage:
osd-devices: 'cinder,10G'
options:
source: *openstack-origin
to:
- '4'
- '5'
- '6'
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
num_units: 3
options:
expected-osd-count: 3
monitor-count: '3'
source: *openstack-origin
to:
- '7'
- '8'
- '9'
gnocchi:
series: *series
charm: cs:gnocchi
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '10'
memcached:
charm: cs:~memcached-team/memcached
num_units: 1
to:
- '11'
mongodb:
charm: cs:mongodb
num_units: 1
to:
- '12'
relations:
- - 'keystone:shared-db'
- 'percona-cluster:shared-db'
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceilometer:amqp'
- 'rabbitmq-server:amqp'
- - 'ceilometer:identity-credentials'
- 'keystone:identity-credentials'
- - 'ceilometer:identity-notifications'
- 'keystone:identity-notifications'
- - 'ceilometer:shared-db'
- 'mongodb:database'
- - 'ceilometer:identity-service'
- 'keystone:identity-service'
- - 'ceilometer:metric-service'
- 'gnocchi:metric-service'
- - 'gnocchi:identity-service'
- 'keystone:identity-service'
- - 'gnocchi:shared-db'
- 'percona-cluster:shared-db'
- - 'gnocchi:storage-ceph'
- 'ceph-mon:client'
- - 'gnocchi:coordinator-memcached'
- 'memcached:cache'

View File

@ -0,0 +1,107 @@
variables:
openstack-origin: &openstack-origin cloud:xenial-queens
series: &series xenial
machines:
0:
constraints: "mem=3072M"
1: {}
2: {}
3: {}
4: {}
5: {}
6: {}
7: {}
8: {}
9: {}
10: {}
11: {}
# We specify machine placements for these to improve iteration
# time, given that machine "0" comes up way before machine "6"
applications:
percona-cluster:
charm: cs:~openstack-charmers-next/percona-cluster
num_units: 1
options:
source: *openstack-origin
to:
- '0'
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '1'
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '2'
ceilometer:
charm: cs:~openstack-charmers-next/ceilometer
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '3'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
num_units: 3
storage:
osd-devices: 'cinder,10G'
options:
source: *openstack-origin
to:
- '4'
- '5'
- '6'
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
num_units: 3
options:
expected-osd-count: 3
monitor-count: '3'
source: *openstack-origin
to:
- '7'
- '8'
- '9'
gnocchi:
series: *series
charm: cs:gnocchi
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '10'
memcached:
charm: cs:~memcached-team/memcached
num_units: 1
to:
- '11'
relations:
- - 'keystone:shared-db'
- 'percona-cluster:shared-db'
- - 'ceph-osd:mon'
- 'ceph-mon:osd'
- - 'ceilometer:amqp'
- 'rabbitmq-server:amqp'
- - 'ceilometer:identity-credentials'
- 'keystone:identity-credentials'
- - 'ceilometer:identity-notifications'
- 'keystone:identity-notifications'
- - 'ceilometer:metric-service'
- 'gnocchi:metric-service'
- - 'gnocchi:identity-service'
- 'keystone:identity-service'
- - 'gnocchi:shared-db'
- 'percona-cluster:shared-db'
- - 'gnocchi:storage-ceph'
- 'ceph-mon:client'
- - 'gnocchi:coordinator-memcached'
- 'memcached:cache'

View File

@ -1,23 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic Gnocchi Charm deployment on bionic-queens."""
from basic_deployment import GnocchiCharmDeployment
if __name__ == '__main__':
deployment = GnocchiCharmDeployment(series='bionic')
deployment.run_tests()

View File

@ -1,24 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic Gnocchi Charm deployment on bionic-rocky."""
from basic_deployment import GnocchiCharmDeployment
if __name__ == '__main__':
deployment = GnocchiCharmDeployment(series='bionic',
openstack='cloud:bionic-rocky')
deployment.run_tests()

View File

@ -1,24 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic Gnocchi Charm deployment on bionic-stein."""
from basic_deployment import GnocchiCharmDeployment
if __name__ == '__main__':
deployment = GnocchiCharmDeployment(series='bionic',
openstack='cloud:bionic-stein')
deployment.run_tests()

View File

@ -1,24 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic Gnocchi Charm deployment on bionic-train."""
from basic_deployment import GnocchiCharmDeployment
if __name__ == '__main__':
deployment = GnocchiCharmDeployment(series='bionic',
openstack='cloud:bionic-train')
deployment.run_tests()

View File

@ -1,24 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic Gnocchi Charm deployment on xenial-ocata."""
from basic_deployment import GnocchiCharmDeployment
if __name__ == '__main__':
deployment = GnocchiCharmDeployment(series='xenial',
openstack='cloud:xenial-ocata')
deployment.run_tests()

View File

@ -1,24 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic Gnocchi Charm deployment on xenial-pike."""
from basic_deployment import GnocchiCharmDeployment
if __name__ == '__main__':
deployment = GnocchiCharmDeployment(series='xenial',
openstack='cloud:xenial-pike')
deployment.run_tests()

View File

@ -1,24 +0,0 @@
#!/usr/bin/env python
#
# Copyright 2016 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Amulet tests on a basic Gnocchi Charm deployment on xenial-queens."""
from basic_deployment import GnocchiCharmDeployment
if __name__ == '__main__':
deployment = GnocchiCharmDeployment(series='xenial',
openstack='cloud:xenial-queens')
deployment.run_tests()

View File

@ -1,17 +1,25 @@
# Bootstrap the model if necessary.
bootstrap: True
# Re-use bootstrap node instead of destroying/re-bootstrapping.
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:
charm_name: gnocchi
gate_bundles:
- xenial-ocata
- xenial-pike
- xenial-queens
- bionic-queens
- bionic-rocky
- bionic-stein
- bionic-train
smoke_bundles:
- bionic-train
dev_bundles:
- eoan-train
tests:
- zaza.openstack.charm_tests.gnocchi.tests.GnocchiTest
configure:
- zaza.openstack.charm_tests.ceilometer.setup.basic_setup
target_deploy_status:
ceilometer:
workload-status: blocked
workload-status-message: Run the ceilometer-upgrade action on the leader to initialize ceilometer and gnocchi
mongodb:
workload-status: unknown
workload-status-message: ''

View File

@ -1,4 +1,4 @@
# Source charm (with amulet): ./src/tox.ini
# Source charm (with zaza): ./src/tox.ini
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of tox.ini for OpenStack Charms:
@ -15,41 +15,36 @@ skip_missing_interpreters = False
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
CHARM_DIR={envdir}
AMULET_SETUP_TIMEOUT=5400
whitelist_externals = juju
passenv = HOME TERM AMULET_* CS_* OS_* TEST_*
passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/test-requirements.txt
install_command =
pip install {opts} {packages}
[testenv:pep8]
basepython = python3
deps=charm-tools
commands = charm-proof
[testenv:func-noop]
# DRY RUN - For Debug
basepython = python2.7
basepython = python3
commands =
bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" -n --no-destroy
functest-run-suite --help
[testenv:func]
# Run all gate tests which are +x (expected to always pass)
basepython = python2.7
basepython = python3
commands =
bundletester -vl DEBUG -r json -o func-results.json --test-pattern "gate-*" --no-destroy
functest-run-suite --keep-model
[testenv:func-smoke]
# Run a specific test as an Amulet smoke test (expected to always pass)
basepython = python2.7
basepython = python3
commands =
bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic-train --no-destroy
functest-run-suite --keep-model --smoke
[testenv:func-dev]
# Run all development test targets which are +x (may not always pass!)
basepython = python2.7
[testenv:func-target]
basepython = python3
commands =
bundletester -vl DEBUG -r json -o func-results.json --test-pattern "dev-*" --no-destroy
functest-run-suite --keep-model --bundle {posargs}
[testenv:venv]
commands = {posargs}

View File

@ -1,6 +1,7 @@
# This file is managed centrally. If you find the need to modify this as a
# one-off, please don't. Intead, consult #openstack-charms and ask about
# requirements management in charms via bot-control. Thank you.
# This file is managed centrally by release-tools and should not be modified
# within individual charm repos. See the 'global' dir contents for available
# choices of *requirements.txt files for OpenStack Charms:
# https://github.com/openstack-charmers/release-tools
#
# Lint and unit test requirements
flake8>=2.2.4,<=2.4.1
@ -11,3 +12,12 @@ mock>=1.2
nose>=1.3.7
coverage>=3.6
git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack
#
# Revisit for removal / mock improvement:
netifaces # vault
psycopg2-binary # vault
tenacity # vault
pbr # vault
cryptography # vault, keystone-saml-mellon
lxml # keystone-saml-mellon
hvac # vault, barbican-vault

View File

@ -50,6 +50,11 @@ basepython = python3.7
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:py38]
basepython = python3.8
deps = -r{toxinidir}/test-requirements.txt
commands = stestr run --slowest {posargs}
[testenv:pep8]
basepython = python3
deps = -r{toxinidir}/test-requirements.txt