summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-03-20 09:15:42 +0000
committerGerrit Code Review <review@openstack.org>2015-03-20 09:15:43 +0000
commit4b238c7b4482111020ed60e84bc64ec9338defca (patch)
treebe323716bda1386be03a13b9afba0d3adc702bd0
parentbdbec9721233a5cb304f0122832002b50832ae8a (diff)
parent5d52f773090ee2d21c4b1d7d5a660be5db9bb48a (diff)
downloadpython-ceilometerclient-4b238c7b4482111020ed60e84bc64ec9338defca.tar.gz
Merge "Add cli functional tests from tempest"
-rw-r--r--ceilometerclient/tests/functional/__init__.py0
-rw-r--r--ceilometerclient/tests/functional/base.py38
-rw-r--r--ceilometerclient/tests/functional/test_readonly_ceilometer.py34
-rw-r--r--test-requirements.txt1
-rw-r--r--tox.ini3
5 files changed, 76 insertions, 0 deletions
diff --git a/ceilometerclient/tests/functional/__init__.py b/ceilometerclient/tests/functional/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ceilometerclient/tests/functional/__init__.py
diff --git a/ceilometerclient/tests/functional/base.py b/ceilometerclient/tests/functional/base.py
new file mode 100644
index 0000000..839748b
--- /dev/null
+++ b/ceilometerclient/tests/functional/base.py
@@ -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)
diff --git a/ceilometerclient/tests/functional/test_readonly_ceilometer.py b/ceilometerclient/tests/functional/test_readonly_ceilometer.py
new file mode 100644
index 0000000..1fa9748
--- /dev/null
+++ b/ceilometerclient/tests/functional/test_readonly_ceilometer.py
@@ -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')
diff --git a/test-requirements.txt b/test-requirements.txt
index 6dffed5..e459423 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -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
diff --git a/tox.ini b/tox.ini
index 2c5a542..baca918 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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