Add cli functional tests from tempest

test_readonly_ceilometer is migrated from
./tempest/cli/simple_read_only/telemetry

A new 'functional' target is available in tox. In order for these
tests to pass OS_PASSWORD, OS_AUTH_URL, OS_USERNAME
and OS_TENANT_NAME need to be set in the environment before running
the tests, e.g:

    source src/devstack/openrc demo demo && tox -efunctional

Subsequent patches will remove tests from tempest and add thes tests
to project-config for gate checks.

Change-Id: I3ce5ddbe471d70e8775ec5a1cc908a95a335b5e7
This commit is contained in:
Chris Dent 2015-03-12 14:01:11 +00:00
parent 72eaed3e7a
commit 5d52f77309
5 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,38 @@
# 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 os
from tempest_lib.cli import base
class ClientTestBase(base.ClientTestBase):
"""Base class for ceilometerclient tests.
Establishes the ceilometer client and retrieves the essential environment
information.
"""
def _get_clients(self):
cli_dir = os.environ.get(
'OS_CEILOMETER_CLIENT_EXEC_DIR',
os.path.join(os.path.abspath('.'), '.tox/functional/bin'))
return base.CLIClient(
username=os.environ.get('OS_USERNAME'),
password=os.environ.get('OS_PASSWORD'),
tenant_name=os.environ.get('OS_TENANT_NAME'),
uri=os.environ.get('OS_AUTH_URL'),
cli_dir=cli_dir)
def ceilometer(self, *args, **kwargs):
return self.clients.ceilometer(*args, **kwargs)

View File

@ -0,0 +1,34 @@
# 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 ceilometerclient.tests.functional import base
class SimpleReadOnlyCeilometerClientTest(base.ClientTestBase):
"""Basic, read-only tests for Ceilometer CLI client.
Checks return values and output of read-only commands.
These tests do not presume any content, nor do they create
their own. They only verify the structure of output if present.
"""
def test_ceilometer_meter_list(self):
self.ceilometer('meter-list')
def test_ceilometer_resource_list(self):
self.ceilometer('resource-list')
def test_ceilometermeter_alarm_list(self):
self.ceilometer('alarm-list')
def test_ceilometer_version(self):
self.ceilometer('', flags='--version')

View File

@ -10,5 +10,6 @@ mock>=1.0
oslosphinx>=2.2.0 # Apache-2.0
python-subunit>=0.0.18
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
tempest-lib>=0.3.0
testrepository>=0.0.18
testtools>=0.9.36,!=1.2.0

View File

@ -24,6 +24,9 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
[testenv:venv]
commands = {posargs}
[testenv:functional]
setenv = OS_TEST_PATH=./ceilometerclient/tests/functional
[testenv:docs]
commands=
python setup.py build_sphinx