Add primary folder structure for Tempest support
Adding folder structure for integration testing with Tempest. Also, adding cli tests for basic testing functionality Change-Id: I69896958495ddf57040a05ff73004662b7b28891 Partially implements: blueprint climate-tempest-testing
This commit is contained in:
parent
ca6d12458b
commit
fc913961c8
13
contrib/tempest/README.rst
Normal file
13
contrib/tempest/README.rst
Normal file
@ -0,0 +1,13 @@
|
||||
This directory contains the files necessary for tempest to cover Climate project.
|
||||
|
||||
To install:
|
||||
|
||||
$ TEMPEST_DIR=/path/to/tempest
|
||||
$ CLIMATE_DIR=/path/to/climate
|
||||
$ cp -R ${CLIMATE_DIR}/contrib/tempest/tempest/* ${TEMPEST_DIR}/tempest/
|
||||
|
||||
For example:
|
||||
$ cp -R /opt/stack/climate/contrib/tempest/tempest/* /opt/stack/tempest/tempest/
|
||||
|
||||
To run cli tests:
|
||||
./run_tests.sh -- tempest.cli.simple_read_only.test_climate
|
25
contrib/tempest/tempest/cli/climateclient.py
Normal file
25
contrib/tempest/tempest/cli/climateclient.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright 2014 Intel Corporation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
from tempest import cli
|
||||
|
||||
|
||||
class ClientTestBase(cli.ClientTestBase):
|
||||
|
||||
def climate(self, action, flags='', params='', admin=True, fail_ok=False):
|
||||
"""Executes climate command for the given action."""
|
||||
return self.cmd_with_auth(
|
||||
'climate', action, flags, params, admin, fail_ok)
|
45
contrib/tempest/tempest/cli/simple_read_only/test_climate.py
Normal file
45
contrib/tempest/tempest/cli/simple_read_only/test_climate.py
Normal file
@ -0,0 +1,45 @@
|
||||
# Copyright 2014 Intel Corporation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
from tempest.cli import climateclient
|
||||
from tempest import config_resource_reservation as config
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class SimpleReadOnlyClimateClientTest(climateclient.ClientTestBase):
|
||||
"""Basic, read-only tests for Climate CLI client.
|
||||
|
||||
Basic smoke test for the Climate CLI commands which do not require
|
||||
creating or modifying leases.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
if (not CONF.service_available.climate):
|
||||
msg = ("Skipping all Climate cli tests because it is "
|
||||
"not available")
|
||||
raise cls.skipException(msg)
|
||||
super(SimpleReadOnlyClimateClientTest, cls).setUpClass()
|
||||
|
||||
def test_climate_lease_list(self):
|
||||
self.climate('lease-list')
|
||||
|
||||
def test_climate_host_list(self):
|
||||
self.climate('host-list')
|
||||
|
||||
def test_climate_version(self):
|
||||
self.climate('', flags='--version')
|
65
contrib/tempest/tempest/config_resource_reservation.py
Normal file
65
contrib/tempest/tempest/config_resource_reservation.py
Normal file
@ -0,0 +1,65 @@
|
||||
# Copyright 2014 Intel Corporation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
from oslo.config import cfg
|
||||
from tempest import config
|
||||
|
||||
|
||||
service_available_group = cfg.OptGroup(name="service_available",
|
||||
title="Available OpenStack Services")
|
||||
|
||||
ServiceAvailableGroup = [
|
||||
cfg.BoolOpt("climate",
|
||||
default=True,
|
||||
help="Whether or not climate is expected to be available"),
|
||||
]
|
||||
|
||||
resource_reservation_group = cfg.OptGroup(name='resource_reservation',
|
||||
title='Resource reservation service '
|
||||
'options')
|
||||
|
||||
ResourceReservationGroup = [
|
||||
cfg.StrOpt('endpoint_type',
|
||||
default='publicURL',
|
||||
choices=['public', 'admin', 'internal',
|
||||
'publicURL', 'adminURL', 'internalURL'],
|
||||
help="The endpoint type to use for the resource_reservation "
|
||||
"service."),
|
||||
]
|
||||
|
||||
|
||||
class TempestConfigPrivateClimate(config.TempestConfigPrivate):
|
||||
"""Climate's config wrap over standard config."""
|
||||
|
||||
def __init__(self, parse_conf=True):
|
||||
super(TempestConfigPrivateClimate, self).__init__()
|
||||
config.register_opt_group(cfg.CONF, service_available_group,
|
||||
ServiceAvailableGroup)
|
||||
config.register_opt_group(cfg.CONF, resource_reservation_group,
|
||||
ResourceReservationGroup)
|
||||
self.resource_reservation = cfg.CONF.resource_reservation
|
||||
|
||||
|
||||
class TempestClimateLazyConfig(object):
|
||||
_config = None
|
||||
|
||||
def __getattr__(self, attr):
|
||||
if not self._config:
|
||||
self._config = TempestConfigPrivateClimate()
|
||||
|
||||
return getattr(self._config, attr)
|
||||
|
||||
|
||||
CONF = TempestClimateLazyConfig()
|
Loading…
x
Reference in New Issue
Block a user