Add test to trap for missing services

Recently when there was an issue with the magnum devstack plugin causing
the shade gate to not have swift, we didn't notice except through the
ansible tests. That's because we have a bunch of has_service checks in
the tests themselves to deal with different configs. Unfortunately, that
makes it easy to fail open.

Put in a test, along with changes to devstack-gate jobs, to throw errors
if services do not show up that should.

Depends-On: I2433c7bced6c8ca785634056de45ddf624031509
Change-Id: I16f477c405583b315fff24929d6c7b2ca4f2eae3
This commit is contained in:
Monty Taylor
2016-12-12 11:09:04 -06:00
parent 9b22e1cea6
commit ecce72199a

View File

@@ -0,0 +1,42 @@
# Copyright (c) 2016 Red Hat, Inc.
#
# 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.
"""
test_devstack
-------------
Throw errors if we do not actually detect the services we're supposed to.
"""
import os
from testscenarios import load_tests_apply_scenarios as load_tests # noqa
from shade.tests.functional import base
class TestDevstack(base.BaseFunctionalTestCase):
scenarios = [
('designate', dict(env='DESIGNATE', service='dns')),
('heat', dict(env='HEAT', service='orchestration')),
('magnum', dict(env='MAGNUM', service='container')),
('neutron', dict(env='NEUTRON', service='network')),
('swift', dict(env='SWIFT', service='object-store')),
]
def test_has_service(self):
if os.environ.get('SHADE_HAS_{env}'.format(env=self.env), '0') == '1':
self.assertTrue(self.demo_cloud.has_service(self.service))