resolved merge conflict after removing test case numbering

This commit is contained in:
nbrust 2016-09-16 10:35:43 -04:00
commit 6c941a7989
2 changed files with 49 additions and 37 deletions

View File

@ -101,13 +101,13 @@ class TroveBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
# Authenticate admin with trove endpoint
trove_ep = self.keystone.service_catalog.url_for(
service_type='trove',
service_type='database',
endpoint_type='publicURL')
keystone_ep = self.keystone.service_catalog.url_for(
service_type='identity',
endpoint_type='publicURL')
self.trove = trove_client.Client(
version='1',
version='1.0',
auth_url=keystone_ep,
username="admin",
password="openstack",
@ -177,10 +177,9 @@ class TroveBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
'internalURL': u.valid_url
}
expected = {
'dns': [endpoint_check],
'database': [endpoint_check],
}
actual = self.keystone.service_catalog.get_endpoints()
ret = u.validate_svc_catalog_endpoint_data(expected, actual)
if ret:
amulet.raise_status(amulet.FAIL, msg=ret)
@ -192,7 +191,7 @@ class TroveBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
u.log.debug('Checking trove api endpoint data...')
endpoints = self.keystone.endpoints.list()
u.log.debug(endpoints)
admin_port = internal_port = public_port = '9001'
admin_port = internal_port = public_port = '8779'
expected = {'id': u.not_null,
'region': 'RegionOne',
'adminurl': u.valid_url,
@ -300,38 +299,6 @@ class TroveBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
u.log.debug('OK')
def test_trove_trove_bind_relation(self):
"""Verify the trove to trove-bind dns-backend relation data"""
u.log.debug('Checking trove:trove-bind dns-backend relation'
'data...')
unit = self.trove_sentry
relation = ['dns-backend', 'trove-bind:dns-backend']
expected = {
'private-address': u.valid_ip,
}
ret = u.validate_relation_data(unit, relation, expected)
if ret:
message = u.relation_error('trove dns-backend', ret)
amulet.raise_status(amulet.FAIL, msg=message)
def test_trove_bind_trove_relation(self):
"""Verify the trove_bind to trove dns-backend relation data"""
u.log.debug('Checking trove-bind:trove dns-backend relation'
'data...')
unit = self.trove_bind_sentry
relation = ['dns-backend', 'trove:dns-backend']
expected = {
'private-address': u.valid_ip,
'rndckey': u.not_null,
'algorithm': 'hmac-md5',
}
ret = u.validate_relation_data(unit, relation, expected)
if ret:
message = u.relation_error('trove dns-backend', ret)
amulet.raise_status(amulet.FAIL, msg=message)
def test_restart_on_config_change(self):
"""Verify that the specified services are restarted when the config
is changed.

45
unit_tests/__init__.py Normal file
View File

@ -0,0 +1,45 @@
# 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 sys
import mock
sys.path.append('src')
sys.path.append('src/lib')
# Mock out charmhelpers so that we can test without it.
# also stops sideeffects from occuring.
charmhelpers = mock.MagicMock()
apt_pkg = mock.MagicMock()
sys.modules['apt_pkg'] = apt_pkg
sys.modules['charmhelpers'] = charmhelpers
sys.modules['charmhelpers.core'] = charmhelpers.core
sys.modules['charmhelpers.core.hookenv'] = charmhelpers.core.hookenv
sys.modules['charmhelpers.core.host'] = charmhelpers.core.host
sys.modules['charmhelpers.core.unitdata'] = charmhelpers.core.unitdata
sys.modules['charmhelpers.core.templating'] = charmhelpers.core.templating
sys.modules['charmhelpers.contrib'] = charmhelpers.contrib
sys.modules['charmhelpers.contrib.openstack'] = charmhelpers.contrib.openstack
sys.modules['charmhelpers.contrib.openstack.utils'] = (
charmhelpers.contrib.openstack.utils)
sys.modules['charmhelpers.contrib.openstack.templating'] = (
charmhelpers.contrib.openstack.templating)
sys.modules['charmhelpers.contrib.network'] = charmhelpers.contrib.network
sys.modules['charmhelpers.contrib.network.ip'] = (
charmhelpers.contrib.network.ip)
sys.modules['charmhelpers.fetch'] = charmhelpers.fetch
sys.modules['charmhelpers.cli'] = charmhelpers.cli
sys.modules['charmhelpers.contrib.hahelpers'] = charmhelpers.contrib.hahelpers
sys.modules['charmhelpers.contrib.hahelpers.cluster'] = (
charmhelpers.contrib.hahelpers.cluster)