summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ceilometerclient/client.py8
-rw-r--r--ceilometerclient/common/utils.py4
-rw-r--r--ceilometerclient/shell.py2
-rw-r--r--ceilometerclient/tests/functional/test_readonly_ceilometer.py47
-rw-r--r--ceilometerclient/tests/unit/v2/test_alarms.py6
-rw-r--r--ceilometerclient/tests/unit/v2/test_shell.py2
-rw-r--r--ceilometerclient/v2/alarms.py5
-rw-r--r--ceilometerclient/v2/shell.py4
-rw-r--r--requirements.txt6
-rw-r--r--test-requirements.txt2
-rw-r--r--tox.ini1
11 files changed, 63 insertions, 24 deletions
diff --git a/ceilometerclient/client.py b/ceilometerclient/client.py
index 6dd72f5..a3fbba5 100644
--- a/ceilometerclient/client.py
+++ b/ceilometerclient/client.py
@@ -15,7 +15,7 @@ from keystoneclient.auth.identity import v3 as v3_auth
from keystoneclient import discover
from keystoneclient import exceptions as ks_exc
from keystoneclient import session
-from oslo.utils import strutils
+from oslo_utils import strutils
import six.moves.urllib.parse as urlparse
from ceilometerclient.common import utils
@@ -257,10 +257,10 @@ def _adjust_kwargs(kwargs):
if insecure:
verify = False
else:
- verify = kwargs.get('cacert') or True
+ verify = client_kwargs.get('cacert') or True
- cert = kwargs.get('cert_file')
- key = kwargs.get('key_file')
+ cert = client_kwargs.get('cert_file')
+ key = client_kwargs.get('key_file')
if cert and key:
cert = cert, key
diff --git a/ceilometerclient/common/utils.py b/ceilometerclient/common/utils.py
index b6408cf..998ada8 100644
--- a/ceilometerclient/common/utils.py
+++ b/ceilometerclient/common/utils.py
@@ -20,8 +20,8 @@ import textwrap
import uuid
from oslo.serialization import jsonutils
-from oslo.utils import encodeutils
-from oslo.utils import importutils
+from oslo_utils import encodeutils
+from oslo_utils import importutils
import prettytable
import six
diff --git a/ceilometerclient/shell.py b/ceilometerclient/shell.py
index 10a43d5..23a9dc1 100644
--- a/ceilometerclient/shell.py
+++ b/ceilometerclient/shell.py
@@ -20,7 +20,7 @@ import argparse
import logging
import sys
-from oslo.utils import encodeutils
+from oslo_utils import encodeutils
import six
import ceilometerclient
diff --git a/ceilometerclient/tests/functional/test_readonly_ceilometer.py b/ceilometerclient/tests/functional/test_readonly_ceilometer.py
index 1fa9748..7b313f3 100644
--- a/ceilometerclient/tests/functional/test_readonly_ceilometer.py
+++ b/ceilometerclient/tests/functional/test_readonly_ceilometer.py
@@ -11,6 +11,7 @@
# under the License.
from ceilometerclient.tests.functional import base
+import re
class SimpleReadOnlyCeilometerClientTest(base.ClientTestBase):
@@ -22,13 +23,49 @@ class SimpleReadOnlyCeilometerClientTest(base.ClientTestBase):
"""
def test_ceilometer_meter_list(self):
- self.ceilometer('meter-list')
+ result = self.ceilometer('meter-list')
+ meters = self.parser.listing(result)
+ self.assertTableStruct(meters, ['Name', 'Type', 'Unit',
+ 'Resource ID', 'Project ID'])
def test_ceilometer_resource_list(self):
- self.ceilometer('resource-list')
+ result = self.ceilometer('resource-list')
+ resources = self.parser.listing(result)
+ self.assertTableStruct(resources, ['Resource ID', 'Source',
+ 'User ID', 'Project ID'])
- def test_ceilometermeter_alarm_list(self):
- self.ceilometer('alarm-list')
+ def test_ceilometer_alarm_list(self):
+ result = self.ceilometer('alarm-list')
+ alarm = self.parser.listing(result)
+ self.assertTableStruct(alarm, ['Alarm ID', 'Name', 'State',
+ 'Enabled', 'Continuous'])
+
+ def test_admin_help(self):
+ help_text = self.ceilometer('help')
+ lines = help_text.split('\n')
+ self.assertFirstLineStartsWith(lines, 'usage: ceilometer')
+
+ commands = []
+ cmds_start = lines.index('Positional arguments:')
+ cmds_end = lines.index('Optional arguments:')
+ command_pattern = re.compile('^ {4}([a-z0-9\-\_]+)')
+ for line in lines[cmds_start:cmds_end]:
+ match = command_pattern.match(line)
+ if match:
+ commands.append(match.group(1))
+ commands = set(commands)
+ wanted_commands = set(('alarm-combination-create', 'alarm-create',
+ 'help', 'alarm-delete', 'event-list'))
+ self.assertFalse(wanted_commands - commands)
+
+ def test_ceilometer_bash_completion(self):
+ self.ceilometer('bash-completion')
+
+ # Optional arguments
def test_ceilometer_version(self):
- self.ceilometer('', flags='--version')
+ version = self.ceilometer('', flags='--version', merge_stderr=True)
+ self.assertTrue(re.search('^[0-9.]+', version))
+
+ def test_ceilometer_debug_list(self):
+ self.ceilometer('meter-list', flags='--debug')
diff --git a/ceilometerclient/tests/unit/v2/test_alarms.py b/ceilometerclient/tests/unit/v2/test_alarms.py
index 9d3b75e..7511557 100644
--- a/ceilometerclient/tests/unit/v2/test_alarms.py
+++ b/ceilometerclient/tests/unit/v2/test_alarms.py
@@ -78,6 +78,7 @@ DELTA_ALARM_RULE = {u'comparison_operator': u'lt',
DELTA_ALARM_TC = [{u'name': u'cons1',
u'duration': 500}]
DELTA_ALARM['time_constraints'] = DELTA_ALARM_TC
+DELTA_ALARM['user_id'] = u'new-user-id'
UPDATED_ALARM = copy.deepcopy(AN_ALARM)
UPDATED_ALARM.update(DELTA_ALARM)
UPDATED_ALARM['threshold_rule'].update(DELTA_ALARM_RULE)
@@ -90,7 +91,7 @@ UPDATED_ALARM['time_constraints'] = [{u'name': u'cons1',
DELTA_ALARM['threshold_rule'] = DELTA_ALARM_RULE
UPDATE_ALARM = copy.deepcopy(UPDATED_ALARM)
UPDATE_ALARM['remove_time_constraints'] = 'cons2'
-del UPDATE_ALARM['user_id']
+UPDATE_ALARM['user_id'] = u'new-user-id'
del UPDATE_ALARM['project_id']
del UPDATE_ALARM['name']
del UPDATE_ALARM['alarm_id']
@@ -128,11 +129,12 @@ DELTA_LEGACY_ALARM = {u'alarm_actions': ['url1', 'url2'],
u'threshold': 42.1}
DELTA_LEGACY_ALARM['time_constraints'] = [{u'name': u'cons1',
u'duration': 500}]
+DELTA_LEGACY_ALARM['user_id'] = u'new-user-id'
DELTA_LEGACY_ALARM['remove_time_constraints'] = 'cons2'
UPDATED_LEGACY_ALARM = copy.deepcopy(AN_LEGACY_ALARM)
UPDATED_LEGACY_ALARM.update(DELTA_LEGACY_ALARM)
UPDATE_LEGACY_ALARM = copy.deepcopy(UPDATED_LEGACY_ALARM)
-del UPDATE_LEGACY_ALARM['user_id']
+UPDATE_LEGACY_ALARM['user_id'] = u'new-user-id'
del UPDATE_LEGACY_ALARM['project_id']
del UPDATE_LEGACY_ALARM['name']
del UPDATE_LEGACY_ALARM['alarm_id']
diff --git a/ceilometerclient/tests/unit/v2/test_shell.py b/ceilometerclient/tests/unit/v2/test_shell.py
index d60b41b..a49029d 100644
--- a/ceilometerclient/tests/unit/v2/test_shell.py
+++ b/ceilometerclient/tests/unit/v2/test_shell.py
@@ -1033,7 +1033,6 @@ class ShellEventListCommandTest(utils.BaseTestCase):
EVENTS = [
{
- "traits": [],
"generated": "2015-01-12T04:03:25.741471",
"message_id": "fb2bef58-88af-4380-8698-e0f18fcf452d",
"event_type": "compute.instance.create.start",
@@ -1044,7 +1043,6 @@ class ShellEventListCommandTest(utils.BaseTestCase):
}],
},
{
- "traits": [],
"generated": "2015-01-12T04:03:28.452495",
"message_id": "9b20509a-576b-4995-acfa-1a24ee5cf49f",
"event_type": "compute.instance.create.end",
diff --git a/ceilometerclient/v2/alarms.py b/ceilometerclient/v2/alarms.py
index a54183a..bc8e999 100644
--- a/ceilometerclient/v2/alarms.py
+++ b/ceilometerclient/v2/alarms.py
@@ -32,9 +32,10 @@ UPDATABLE_ATTRIBUTES = [
'ok_actions',
'insufficient_data_actions',
'repeat_actions',
+ 'project_id',
+ 'user_id'
]
-CREATION_ATTRIBUTES = UPDATABLE_ATTRIBUTES + ['project_id', 'user_id',
- 'time_constraints']
+CREATION_ATTRIBUTES = UPDATABLE_ATTRIBUTES + ['time_constraints']
class Alarm(base.Resource):
diff --git a/ceilometerclient/v2/shell.py b/ceilometerclient/v2/shell.py
index 4e8e2d2..bb09e18 100644
--- a/ceilometerclient/v2/shell.py
+++ b/ceilometerclient/v2/shell.py
@@ -23,7 +23,7 @@ import functools
import json
from oslo.serialization import jsonutils
-from oslo.utils import strutils
+from oslo_utils import strutils
import six
from ceilometerclient.common import utils
@@ -1047,7 +1047,7 @@ def do_event_list(cc, args={}):
def do_event_show(cc, args={}):
"""Show a particular event."""
event = cc.events.get(args.message_id)
- fields = ['event_type', 'generated', 'traits']
+ fields = ['event_type', 'generated', 'traits', 'raw']
data = dict([(f, getattr(event, f, '')) for f in fields])
utils.print_dict(data, wrap=72)
diff --git a/requirements.txt b/requirements.txt
index bbeb1b6..593f808 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,14 +1,14 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-pbr>=0.6,!=0.7,<1.0
+pbr>=0.11,<2.0
argparse
iso8601>=0.1.9
oslo.i18n>=1.5.0 # Apache-2.0
oslo.serialization>=1.4.0 # Apache-2.0
oslo.utils>=1.4.0 # Apache-2.0
PrettyTable>=0.7,<0.8
-python-keystoneclient>=1.1.0
-requests>=2.2.0,!=2.4.0
+python-keystoneclient>=1.3.0
+requests>=2.5.2
six>=1.9.0
stevedore>=1.3.0 # Apache-2.0
diff --git a/test-requirements.txt b/test-requirements.txt
index 99e1c7c..231c9c6 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -10,6 +10,6 @@ mock>=1.0
oslosphinx>=2.5.0 # Apache-2.0
python-subunit>=0.0.18
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
-tempest-lib>=0.4.0
+tempest-lib>=0.5.0
testrepository>=0.0.18
testtools>=0.9.36,!=1.2.0
diff --git a/tox.ini b/tox.ini
index baca918..c0d1f63 100644
--- a/tox.ini
+++ b/tox.ini
@@ -26,6 +26,7 @@ commands = {posargs}
[testenv:functional]
setenv = OS_TEST_PATH=./ceilometerclient/tests/functional
+passenv = OS_*
[testenv:docs]
commands=