Enable Bionic as a gate test

Change bionic test from dev to gate for 18.05.

Change-Id: I4e3c30a2dc5cc084149710a06a6c212b1b48459c
This commit is contained in:
David Ames 2018-05-08 12:00:00 -07:00
parent 6a218749d7
commit a3377912a4
6 changed files with 180 additions and 13 deletions

View File

@ -106,6 +106,60 @@ def computed_debug_level(config):
return "WARNING"
class TransportURLAdapter(charms_openstack.adapters.RabbitMQRelationAdapter):
"""Add Transport URL to RabbitMQRelationAdapter
TODO: Move to charms.openstack.adapters
"""
DEFAULT_PORT = '5672'
def __init__(self, relation):
super(TransportURLAdapter, self).__init__(relation)
self.transport_url
@property
def transport_url(self):
"""Return the transport URL for communicating with rabbitmq
:returns: string transport URL
"""
if self.hosts:
hosts = self.hosts.split(',')
else:
hosts = [self.host]
if hosts:
transport_url_hosts = ','.join([
"{}:{}@{}:{}".format(self.username,
self.password,
host_,
self.port)
for host_ in hosts])
return "rabbit://{}/{}".format(transport_url_hosts, self.vhost)
@property
def port(self):
"""Return the port for commuicating with rabbitmq
:returns: int port number
"""
return self.ssl_port or self.DEFAULT_PORT
class ManilaRelationAdapters(
charms_openstack.adapters.OpenStackAPIRelationAdapters):
"""
Adapters collection to append specific adapters for Manila
"""
relation_adapters = {
'amqp': TransportURLAdapter,
'shared_db': charms_openstack.adapters.DatabaseRelationAdapter,
'cluster': charms_openstack.adapters.PeerHARelationAdapter,
'coordinator_memcached': (
charms_openstack.adapters.MemcacheRelationAdapter),
}
###
# Implementation of the Manila Charm classes
@ -138,6 +192,8 @@ class ManilaCharm(charms_openstack.charm.HAOpenStackCharm):
# Note that the hsm interface is optional - defined in config.yaml
required_relations = ['shared-db', 'amqp', 'identity-service']
adapters_class = ManilaRelationAdapters
restart_map = {
MANILA_CONF: services,
MANILA_API_PASTE_CONF: services,

View File

@ -0,0 +1,81 @@
# Note that the original manila.conf file is extensive and has many options
# that the charm does not set. Please refer to that file if there are options
# that you think the charm should set, but doesn't, or provide options for.
# Please file a bug at: https://bugs.launchpad.net/charm-barbican/+filebug for
# any changes you need made or intend to modify in the charm.
[DEFAULT]
# This all needs to be configurable
enabled_share_backends = {{ options.computed_share_backends }}
# enabled_share_protocols = NFS,CIFS
enabled_share_protocols = {{ options.computed_share_protocols }}
#default_share_type = default_share_type
default_share_type = {{ options.default_share_type }}
state_path = /var/lib/manila
osapi_share_extension = manila.api.contrib.standard_extenstions
rootwrap_config = /etc/manila/rootwrap.conf
api_paste_config = /etc/manila/api-paste.ini
share_name_template = share-%s
scheduler_driver = manila.scheduler.drivers.filter.FilterScheduler
debug = {{ options.debug }}
# Number of workers for OpenStack Share API service. (integer value)
osapi_share_workers = {{ options.workers }}
{% if amqp.transport_url -%}
transport_url = {{ amqp.transport_url }}
{% endif -%}
[cors]
#
# From oslo.middleware.cors
#
[cors.subdomain]
#
# From oslo.middleware.cors
#
# parts/section-database includes the [database] section identifier
{% include "parts/section-database" %}
# parts/section-keystone-authtoken includes the [keystone_authtoken] section
# identifier
{% include "parts/section-keystone-authtoken" %}
[matchmaker_redis]
#
# From oslo.messaging
#
[oslo_messaging_amqp]
#
# From oslo.messaging
#
[oslo_messaging_notifications]
#
# From oslo.messaging
#
#
# Now configuration from the backend manila-plugin charms
#
{% for line in options.computed_backend_lines_manila_conf %}
{{ line }}
{%- endfor %}

View File

@ -31,7 +31,10 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment):
"""
super(ManilaBasicDeployment, self).__init__(
series, openstack, source, stable)
self._keystone_version = '2'
if self._get_openstack_release() >= self.xenial_queens:
self._keystone_version = '3'
else:
self._keystone_version = '2'
self._add_services()
self._add_relations()
self._configure_services()
@ -103,11 +106,10 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment):
u.log.debug('openstack release str: {}'.format(
self._get_openstack_release_string()))
# Authenticate admin with keystone endpoint
self.keystone = u.authenticate_keystone_admin(self.keystone_sentry,
user='admin',
password='openstack',
tenant='admin')
# Authenticate admin with keystone
self.keystone_session, self.keystone = u.get_default_keystone_session(
self.keystone_sentry,
openstack_release=self._get_openstack_release())
def test_100_services(self):
"""Verify the expected services are running on the corresponding
@ -174,6 +176,7 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment):
u.log.debug('Checking manila api endpoint data...')
endpoints = self.keystone.endpoints.list()
u.log.debug(endpoints)
expected_num_eps = 3
admin_port = '8786'
internal_port = public_port = admin_port
if self._keystone_version == '2':
@ -187,6 +190,8 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment):
ret = u.validate_endpoint_data(
endpoints, admin_port, internal_port, public_port, expected)
elif self._keystone_version == '3':
if self._get_openstack_release() >= self.xenial_queens:
expected_num_eps = 6
# For keystone v3 it's slightly different.
expected = {'id': u.not_null,
'region': 'RegionOne',
@ -196,7 +201,8 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment):
'service_id': u.not_null}
ret = u.validate_v3_endpoint_data(
endpoints, admin_port, internal_port, public_port, expected)
endpoints, admin_port, internal_port, public_port, expected,
expected_num_eps=expected_num_eps)
else:
raise RuntimeError("Unexpected self._keystone_version: {}"
.format(self._keystone_version))
@ -339,6 +345,7 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment):
# a demo user, demo project, and then get a demo manila client and do
# the secret. ensure that the default domain is created.
keystone_ip = self.keystone_sentry.info['public-address']
if self._keystone_version == '2':
# find or create the 'demo' tenant (project)
tenant = self._find_or_create(
@ -371,6 +378,14 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment):
create=lambda: self.keystone.roles.add_user_role(
demo_user, admin_role, tenant=tenant))
# Authenticate demo user with keystone
self.demo_user_session, _ = u.get_keystone_session(
keystone_ip,
'demo',
'pass',
api_version=2,
project_name='demo',
)
else:
# find or create the 'default' domain
domain = self._find_or_create(
@ -419,15 +434,20 @@ class ManilaBasicDeployment(OpenStackAmuletDeployment):
role=admin_role,
user=demo_user,
project=demo_project)
self.keystone_demo = u.authenticate_keystone_user(
self.keystone, user='demo',
password='pass', tenant='demo')
self.demo_user_session, _ = u.get_keystone_session(
keystone_ip,
'demo',
'pass',
api_version=3,
project_name='demo',
user_domain_name='default',
project_domain_name='default',
)
# Authenticate admin with manila endpoint
manila_ep = self.keystone.service_catalog.url_for(
service_type='share', interface='publicURL')
manila = manila_client.Client(session=self.keystone_demo.session,
manila = manila_client.Client(session=self.demo_user_session,
endpoint=manila_ep)
# now just try a list the shares
# NOTE(AJK) the 'search_opts={}' is to work around Bug#1707303

View File

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

View File

@ -35,7 +35,7 @@ commands =
# Run a specific test as an Amulet smoke test (expected to always pass)
basepython = python2.7
commands =
bundletester -vl DEBUG -r json -o func-results.json gate-basic-xenial-pike --no-destroy
bundletester -vl DEBUG -r json -o func-results.json gate-basic-bionic-queens --no-destroy
[testenv:func27-dfs]
# Run all deploy-from-source tests which are +x (may not always pass!)