Merge tag '2.6.1' into debian/newton
python-ceilometerclient 2.6.1 release [ Ondřej Nový ] * Standards-Version is 3.9.8 now (no change) * Change directory to $ADTTMP before running Debian tests * d/copyright: Changed source URL to https protocol [ Corey Bryant ] * New upstream release. * .gitreview: Copy from orig tar file. * d/gbp.conf: Update debian-branch for Newton. * d/control: Align (Build-)Depends with upstream. * d/p/skip-tests.patch: Rebased. * ceilometerclient/v2/client.py: Copy from orig tar file. [ Thomas Goirand ] * New upstream release. * Using pkgos-dh_auto_{install,test} from openstack-pkg-tools >= 52~. * Using OpenStack's Gerrit as VCS URLs. Change-Id: I4f735ecb93f38a1c28d39424c51e163b67b0ed53
This commit is contained in:
@@ -118,6 +118,16 @@ for obj_name in dir(sys.modules[__name__]):
|
|||||||
|
|
||||||
|
|
||||||
def from_response(response, details=None):
|
def from_response(response, details=None):
|
||||||
"""Return an instance of an HTTPException based on httplib response."""
|
"""Return an instance of an HTTPException based on http response."""
|
||||||
cls = _code_map.get(response.status, HTTPException)
|
if hasattr(response, "status"):
|
||||||
|
# it is response from HTTPClient (httplib)
|
||||||
|
code = response.status
|
||||||
|
elif hasattr(response, "status_code"):
|
||||||
|
# it is response from SessionClient (requests)
|
||||||
|
code = response.status_code
|
||||||
|
else:
|
||||||
|
# it is something unexpected
|
||||||
|
raise TypeError("Function 'from_response' expects only response object"
|
||||||
|
" from httplib or requests libraries.")
|
||||||
|
cls = _code_map.get(code, HTTPException)
|
||||||
return cls(details)
|
return cls(details)
|
||||||
|
@@ -1,64 +0,0 @@
|
|||||||
# 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 keystoneclient.v2_0 import client as ksclient
|
|
||||||
|
|
||||||
|
|
||||||
def script_keystone_client():
|
|
||||||
ksclient.Client(auth_url='http://no.where',
|
|
||||||
insecure=False,
|
|
||||||
password='password',
|
|
||||||
tenant_id='',
|
|
||||||
tenant_name='tenant_name',
|
|
||||||
username='username').AndReturn(FakeKeystone('abcd1234'))
|
|
||||||
|
|
||||||
|
|
||||||
def fake_headers():
|
|
||||||
return {'X-Auth-Token': 'abcd1234',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'User-Agent': 'python-ceilometerclient'}
|
|
||||||
|
|
||||||
|
|
||||||
class FakeServiceCatalog(object):
|
|
||||||
@staticmethod
|
|
||||||
def url_for(endpoint_type, service_type):
|
|
||||||
return 'http://192.168.1.5:8004/v1/f14b41234'
|
|
||||||
|
|
||||||
|
|
||||||
class FakeKeystone(object):
|
|
||||||
service_catalog = FakeServiceCatalog()
|
|
||||||
|
|
||||||
def __init__(self, auth_token):
|
|
||||||
self.auth_token = auth_token
|
|
||||||
|
|
||||||
|
|
||||||
class FakeHTTPResponse(object):
|
|
||||||
|
|
||||||
version = 1.1
|
|
||||||
|
|
||||||
def __init__(self, status, reason, headers, body):
|
|
||||||
self.headers = headers
|
|
||||||
self.body = body
|
|
||||||
self.status = status
|
|
||||||
self.reason = reason
|
|
||||||
|
|
||||||
def getheader(self, name, default=None):
|
|
||||||
return self.headers.get(name, default)
|
|
||||||
|
|
||||||
def getheaders(self):
|
|
||||||
return self.headers.items()
|
|
||||||
|
|
||||||
def read(self, amt=None):
|
|
||||||
b = self.body
|
|
||||||
self.body = None
|
|
||||||
return b
|
|
@@ -22,7 +22,6 @@ import requests
|
|||||||
from ceilometerclient import client
|
from ceilometerclient import client
|
||||||
from ceilometerclient import exc
|
from ceilometerclient import exc
|
||||||
from ceilometerclient.openstack.common.apiclient import exceptions
|
from ceilometerclient.openstack.common.apiclient import exceptions
|
||||||
from ceilometerclient.tests.unit import fakes
|
|
||||||
from ceilometerclient.tests.unit import utils
|
from ceilometerclient.tests.unit import utils
|
||||||
from ceilometerclient.v2 import client as v2client
|
from ceilometerclient.v2 import client as v2client
|
||||||
|
|
||||||
@@ -77,7 +76,6 @@ class ClientTest(utils.BaseTestCase):
|
|||||||
c2 = self.create_client(env)
|
c2 = self.create_client(env)
|
||||||
self.assertIsInstance(c2, v2client.Client)
|
self.assertIsInstance(c2, v2client.Client)
|
||||||
|
|
||||||
@mock.patch('keystoneclient.v2_0.client', fakes.FakeKeystone)
|
|
||||||
def test_client_without_auth_plugin(self):
|
def test_client_without_auth_plugin(self):
|
||||||
env = FAKE_ENV.copy()
|
env = FAKE_ENV.copy()
|
||||||
del env['auth_plugin']
|
del env['auth_plugin']
|
||||||
@@ -201,7 +199,6 @@ class ClientTestWithAodh(ClientTest):
|
|||||||
return_value=mock.MagicMock()):
|
return_value=mock.MagicMock()):
|
||||||
return client.get_client(api_version, **env)
|
return client.get_client(api_version, **env)
|
||||||
|
|
||||||
@mock.patch('keystoneclient.v2_0.client', fakes.FakeKeystone)
|
|
||||||
def test_client_without_auth_plugin(self):
|
def test_client_without_auth_plugin(self):
|
||||||
env = FAKE_ENV.copy()
|
env = FAKE_ENV.copy()
|
||||||
del env['auth_plugin']
|
del env['auth_plugin']
|
||||||
|
@@ -69,3 +69,19 @@ class HTTPExceptionsTest(utils.BaseTestCase):
|
|||||||
{"error_message": {"faultstring": "oops"}}))
|
{"error_message": {"faultstring": "oops"}}))
|
||||||
ret_str = k + " (HTTP " + str(exception.code) + ") ERROR oops"
|
ret_str = k + " (HTTP " + str(exception.code) + ") ERROR oops"
|
||||||
self.assertEqual(ret_str, str(exception))
|
self.assertEqual(ret_str, str(exception))
|
||||||
|
|
||||||
|
def test_from_response(self):
|
||||||
|
class HTTPLibLikeResponse(object):
|
||||||
|
status = 400
|
||||||
|
|
||||||
|
class RequestsLikeResponse(object):
|
||||||
|
status_code = 401
|
||||||
|
|
||||||
|
class UnexpectedResponse(object):
|
||||||
|
code = 200
|
||||||
|
|
||||||
|
self.assertEqual(HTTPLibLikeResponse.status,
|
||||||
|
exc.from_response(HTTPLibLikeResponse).code)
|
||||||
|
self.assertEqual(RequestsLikeResponse.status_code,
|
||||||
|
exc.from_response(RequestsLikeResponse).code)
|
||||||
|
self.assertRaises(TypeError, exc.from_response, UnexpectedResponse)
|
||||||
|
@@ -279,8 +279,8 @@ class AlarmManagerTest(testtools.TestCase):
|
|||||||
'GET', '/v2/alarms'
|
'GET', '/v2/alarms'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(alarms), 1)
|
self.assertEqual(1, len(alarms))
|
||||||
self.assertEqual(alarms[0].alarm_id, 'alarm-id')
|
self.assertEqual('alarm-id', alarms[0].alarm_id)
|
||||||
|
|
||||||
def test_list_with_query(self):
|
def test_list_with_query(self):
|
||||||
alarms = list(self.mgr.list(q=[{"field": "project_id",
|
alarms = list(self.mgr.list(q=[{"field": "project_id",
|
||||||
@@ -293,8 +293,8 @@ class AlarmManagerTest(testtools.TestCase):
|
|||||||
'&q.type=&q.type=&q.value=project-id&q.value=SwiftObjectAlarm',
|
'&q.type=&q.type=&q.value=project-id&q.value=SwiftObjectAlarm',
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(alarms), 1)
|
self.assertEqual(1, len(alarms))
|
||||||
self.assertEqual(alarms[0].alarm_id, 'alarm-id')
|
self.assertEqual('alarm-id', alarms[0].alarm_id)
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
alarm = self.mgr.get(alarm_id='alarm-id')
|
alarm = self.mgr.get(alarm_id='alarm-id')
|
||||||
@@ -303,7 +303,7 @@ class AlarmManagerTest(testtools.TestCase):
|
|||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertIsNotNone(alarm)
|
self.assertIsNotNone(alarm)
|
||||||
self.assertEqual(alarm.alarm_id, 'alarm-id')
|
self.assertEqual('alarm-id', alarm.alarm_id)
|
||||||
self.assertEqual(alarm.rule, alarm.threshold_rule)
|
self.assertEqual(alarm.rule, alarm.threshold_rule)
|
||||||
|
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
@@ -325,7 +325,7 @@ class AlarmManagerTest(testtools.TestCase):
|
|||||||
self.http_client.assert_called(*expect_get, pos=0)
|
self.http_client.assert_called(*expect_get, pos=0)
|
||||||
self.http_client.assert_called(*expect_put, pos=1)
|
self.http_client.assert_called(*expect_put, pos=1)
|
||||||
self.assertIsNotNone(alarm)
|
self.assertIsNotNone(alarm)
|
||||||
self.assertEqual(alarm.alarm_id, 'alarm-id')
|
self.assertEqual('alarm-id', alarm.alarm_id)
|
||||||
for (key, value) in six.iteritems(UPDATED_ALARM):
|
for (key, value) in six.iteritems(UPDATED_ALARM):
|
||||||
self.assertEqual(getattr(alarm, key), value)
|
self.assertEqual(getattr(alarm, key), value)
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ class AlarmManagerTest(testtools.TestCase):
|
|||||||
self.http_client.assert_called(*expect_get, pos=0)
|
self.http_client.assert_called(*expect_get, pos=0)
|
||||||
self.http_client.assert_called(*expect_put, pos=1)
|
self.http_client.assert_called(*expect_put, pos=1)
|
||||||
self.assertIsNotNone(alarm)
|
self.assertIsNotNone(alarm)
|
||||||
self.assertEqual(alarm.alarm_id, 'alarm-id')
|
self.assertEqual('alarm-id', alarm.alarm_id)
|
||||||
for (key, value) in six.iteritems(UPDATED_ALARM):
|
for (key, value) in six.iteritems(UPDATED_ALARM):
|
||||||
self.assertEqual(getattr(alarm, key), value)
|
self.assertEqual(getattr(alarm, key), value)
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ class AlarmManagerTest(testtools.TestCase):
|
|||||||
'PUT', '/v2/alarms/alarm-id/state'
|
'PUT', '/v2/alarms/alarm-id/state'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect, body='alarm')
|
self.http_client.assert_called(*expect, body='alarm')
|
||||||
self.assertEqual(state, {'alarm': 'alarm'})
|
self.assertEqual({'alarm': 'alarm'}, state)
|
||||||
|
|
||||||
def test_get_state(self):
|
def test_get_state(self):
|
||||||
state = self.mgr.get_state(alarm_id='alarm-id')
|
state = self.mgr.get_state(alarm_id='alarm-id')
|
||||||
@@ -358,7 +358,7 @@ class AlarmManagerTest(testtools.TestCase):
|
|||||||
'GET', '/v2/alarms/alarm-id/state'
|
'GET', '/v2/alarms/alarm-id/state'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(state, {'alarm': 'alarm'})
|
self.assertEqual({'alarm': 'alarm'}, state)
|
||||||
|
|
||||||
def test_delete(self):
|
def test_delete(self):
|
||||||
deleted = self.mgr.delete(alarm_id='victim-id')
|
deleted = self.mgr.delete(alarm_id='victim-id')
|
||||||
@@ -472,7 +472,7 @@ class AlarmLegacyManagerTest(testtools.TestCase):
|
|||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect_put)
|
self.http_client.assert_called(*expect_put)
|
||||||
self.assertIsNotNone(alarm)
|
self.assertIsNotNone(alarm)
|
||||||
self.assertEqual(alarm.alarm_id, 'alarm-id')
|
self.assertEqual('alarm-id', alarm.alarm_id)
|
||||||
for (key, value) in six.iteritems(UPDATED_ALARM):
|
for (key, value) in six.iteritems(UPDATED_ALARM):
|
||||||
self.assertEqual(getattr(alarm, key), value)
|
self.assertEqual(getattr(alarm, key), value)
|
||||||
|
|
||||||
@@ -487,7 +487,7 @@ class AlarmLegacyManagerTest(testtools.TestCase):
|
|||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect_put)
|
self.http_client.assert_called(*expect_put)
|
||||||
self.assertIsNotNone(alarm)
|
self.assertIsNotNone(alarm)
|
||||||
self.assertEqual(alarm.alarm_id, 'alarm-id')
|
self.assertEqual('alarm-id', alarm.alarm_id)
|
||||||
for (key, value) in six.iteritems(UPDATED_ALARM):
|
for (key, value) in six.iteritems(UPDATED_ALARM):
|
||||||
self.assertEqual(getattr(alarm, key), value)
|
self.assertEqual(getattr(alarm, key), value)
|
||||||
|
|
||||||
|
@@ -43,8 +43,8 @@ class EventTypesManagerTest(utils.BaseTestCase):
|
|||||||
'GET', '/v2/event_types/'
|
'GET', '/v2/event_types/'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(event_types), 4)
|
self.assertEqual(4, len(event_types))
|
||||||
self.assertEqual(event_types[0].event_type, "Foo")
|
self.assertEqual("Foo", event_types[0].event_type)
|
||||||
self.assertEqual(event_types[1].event_type, "Bar")
|
self.assertEqual("Bar", event_types[1].event_type)
|
||||||
self.assertEqual(event_types[2].event_type, "Sna")
|
self.assertEqual("Sna", event_types[2].event_type)
|
||||||
self.assertEqual(event_types[3].event_type, "Fu")
|
self.assertEqual("Fu", event_types[3].event_type)
|
||||||
|
@@ -100,9 +100,9 @@ class ResourceManagerTest(utils.BaseTestCase):
|
|||||||
'GET', '/v2/resources?meter_links=0'
|
'GET', '/v2/resources?meter_links=0'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(resources), 2)
|
self.assertEqual(2, len(resources))
|
||||||
self.assertEqual(resources[0].resource_id, 'a')
|
self.assertEqual('a', resources[0].resource_id)
|
||||||
self.assertEqual(resources[1].resource_id, 'b')
|
self.assertEqual('b', resources[1].resource_id)
|
||||||
|
|
||||||
def test_list_all_with_links_enabled(self):
|
def test_list_all_with_links_enabled(self):
|
||||||
resources = list(self.mgr.list(links=True))
|
resources = list(self.mgr.list(links=True))
|
||||||
@@ -121,7 +121,7 @@ class ResourceManagerTest(utils.BaseTestCase):
|
|||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertIsNotNone(resource)
|
self.assertIsNotNone(resource)
|
||||||
self.assertEqual(resource.resource_id, 'a')
|
self.assertEqual('a', resource.resource_id)
|
||||||
|
|
||||||
def test_list_by_query(self):
|
def test_list_by_query(self):
|
||||||
resources = list(self.mgr.list(q=[{"field": "resource_id",
|
resources = list(self.mgr.list(q=[{"field": "resource_id",
|
||||||
@@ -132,8 +132,8 @@ class ResourceManagerTest(utils.BaseTestCase):
|
|||||||
'&q.type=&q.value=a&meter_links=0'
|
'&q.type=&q.value=a&meter_links=0'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(resources), 1)
|
self.assertEqual(1, len(resources))
|
||||||
self.assertEqual(resources[0].resource_id, 'a')
|
self.assertEqual('a', resources[0].resource_id)
|
||||||
|
|
||||||
def test_get_from_resource_class(self):
|
def test_get_from_resource_class(self):
|
||||||
resource = self.mgr.get(resource_id='a')
|
resource = self.mgr.get(resource_id='a')
|
||||||
|
@@ -147,8 +147,8 @@ class OldSampleManagerTest(utils.BaseTestCase):
|
|||||||
'GET', '/v2/meters/instance'
|
'GET', '/v2/meters/instance'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(samples), 1)
|
self.assertEqual(1, len(samples))
|
||||||
self.assertEqual(samples[0].resource_id, 'resource-id')
|
self.assertEqual('resource-id', samples[0].resource_id)
|
||||||
|
|
||||||
def test_list_by_meter_name_extended(self):
|
def test_list_by_meter_name_extended(self):
|
||||||
samples = list(self.mgr.list(meter_name='instance',
|
samples = list(self.mgr.list(meter_name='instance',
|
||||||
@@ -160,7 +160,7 @@ class OldSampleManagerTest(utils.BaseTestCase):
|
|||||||
]))
|
]))
|
||||||
expect = ['GET', '%s?%s' % (METER_URL, QUERIES)]
|
expect = ['GET', '%s?%s' % (METER_URL, QUERIES)]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(samples), 0)
|
self.assertEqual(0, len(samples))
|
||||||
|
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
sample = self.mgr.create(**CREATE_SAMPLE)
|
sample = self.mgr.create(**CREATE_SAMPLE)
|
||||||
@@ -200,7 +200,7 @@ class OldSampleManagerTest(utils.BaseTestCase):
|
|||||||
samples = list(self.mgr.list(meter_name='instance', limit=1))
|
samples = list(self.mgr.list(meter_name='instance', limit=1))
|
||||||
expect = ['GET', '/v2/meters/instance?limit=1']
|
expect = ['GET', '/v2/meters/instance?limit=1']
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(samples), 1)
|
self.assertEqual(1, len(samples))
|
||||||
|
|
||||||
|
|
||||||
class SampleManagerTest(utils.BaseTestCase):
|
class SampleManagerTest(utils.BaseTestCase):
|
||||||
|
@@ -538,72 +538,11 @@ class ShellAlarmGnocchiCommandTest(test_shell.ShellTestBase):
|
|||||||
ceilometer_shell.\
|
ceilometer_shell.\
|
||||||
do_alarm_gnocchi_aggregation_by_metrics_threshold_create(
|
do_alarm_gnocchi_aggregation_by_metrics_threshold_create(
|
||||||
self.cc, self.args)
|
self.cc, self.args)
|
||||||
self.assertEqual('''\
|
stdout = sys.stdout.getvalue()
|
||||||
+---------------------------+------------------------------------------\
|
self.assertIn("b69ecdb9-f19b-4fb5-950f-5eb53938b718", stdout)
|
||||||
--------------------------+
|
self.assertIn("[\"http://something/alarm\"]", stdout)
|
||||||
| Property | Value \
|
self.assertIn("description_gnocchi_alarm", stdout)
|
||||||
|
|
self.assertIn("gnocchi_aggregation_by_metrics_threshold", stdout)
|
||||||
+---------------------------+------------------------------------------\
|
|
||||||
--------------------------+
|
|
||||||
| aggregation_method | count \
|
|
||||||
|
|
|
||||||
| alarm_actions | ["http://something/alarm"] \
|
|
||||||
|
|
|
||||||
| alarm_id | b69ecdb9-f19b-4fb5-950f-5eb53938b718 \
|
|
||||||
|
|
|
||||||
| comparison_operator | le \
|
|
||||||
|
|
|
||||||
| description | description_gnocchi_alarm \
|
|
||||||
|
|
|
||||||
| enabled | True \
|
|
||||||
|
|
|
||||||
| evaluation_periods | 3 \
|
|
||||||
|
|
|
||||||
| granularity | 60 \
|
|
||||||
|
|
|
||||||
| insufficient_data_actions | ["http://something/insufficient"] \
|
|
||||||
|
|
|
||||||
| metrics | ["b3d9d8ab-05e8-439f-89ad-5e978dd2a5eb", \
|
|
||||||
"009d4faf-c275-46f0-8f2d- |
|
|
||||||
| | 670b15bac2b0"] \
|
|
||||||
|
|
|
||||||
| name | name_gnocchi_alarm \
|
|
||||||
|
|
|
||||||
| ok_actions | ["http://something/ok"] \
|
|
||||||
|
|
|
||||||
| project_id | 97fcad0402ce4f65ac3bd42a0c6a7e74 \
|
|
||||||
|
|
|
||||||
| repeat_actions | True \
|
|
||||||
|
|
|
||||||
| severity | critical \
|
|
||||||
|
|
|
||||||
| state | ok \
|
|
||||||
|
|
|
||||||
| threshold | 70.0 \
|
|
||||||
|
|
|
||||||
| time_constraints | [{name: cons1, \
|
|
||||||
|
|
|
||||||
| | description: desc1, \
|
|
||||||
|
|
|
||||||
| | start: 0 11 * * *, \
|
|
||||||
|
|
|
||||||
| | duration: 300}, \
|
|
||||||
|
|
|
||||||
| | {name: cons2, \
|
|
||||||
|
|
|
||||||
| | description: desc2, \
|
|
||||||
|
|
|
||||||
| | start: 0 23 * * *, \
|
|
||||||
|
|
|
||||||
| | duration: 600}] \
|
|
||||||
|
|
|
||||||
| type | gnocchi_aggregation_by_metrics_threshold \
|
|
||||||
|
|
|
||||||
| user_id | f28735621ee84f329144eb467c91fce6 \
|
|
||||||
|
|
|
||||||
+---------------------------+------------------------------------------\
|
|
||||||
--------------------------+
|
|
||||||
''', sys.stdout.getvalue())
|
|
||||||
|
|
||||||
@mock.patch('sys.stdout', new=six.StringIO())
|
@mock.patch('sys.stdout', new=six.StringIO())
|
||||||
def test_do_alarm_gnocchi_aggr_by_resources_threshold_create(self):
|
def test_do_alarm_gnocchi_aggr_by_resources_threshold_create(self):
|
||||||
|
@@ -125,8 +125,8 @@ class StatisticsManagerTest(utils.BaseTestCase):
|
|||||||
'GET', '/v2/meters/instance/statistics'
|
'GET', '/v2/meters/instance/statistics'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(stats), 1)
|
self.assertEqual(1, len(stats))
|
||||||
self.assertEqual(stats[0].count, 135)
|
self.assertEqual(135, stats[0].count)
|
||||||
|
|
||||||
def test_list_by_meter_name_extended(self):
|
def test_list_by_meter_name_extended(self):
|
||||||
stats = list(self.mgr.list(meter_name='instance',
|
stats = list(self.mgr.list(meter_name='instance',
|
||||||
@@ -140,8 +140,8 @@ class StatisticsManagerTest(utils.BaseTestCase):
|
|||||||
'GET', '%s?%s' % (base_url, qry)
|
'GET', '%s?%s' % (base_url, qry)
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(stats), 1)
|
self.assertEqual(1, len(stats))
|
||||||
self.assertEqual(stats[0].count, 135)
|
self.assertEqual(135, stats[0].count)
|
||||||
|
|
||||||
def test_list_by_meter_name_with_period(self):
|
def test_list_by_meter_name_with_period(self):
|
||||||
stats = list(self.mgr.list(meter_name='instance',
|
stats = list(self.mgr.list(meter_name='instance',
|
||||||
@@ -156,8 +156,8 @@ class StatisticsManagerTest(utils.BaseTestCase):
|
|||||||
'GET', '%s?%s%s' % (base_url, qry, period)
|
'GET', '%s?%s%s' % (base_url, qry, period)
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(stats), 1)
|
self.assertEqual(1, len(stats))
|
||||||
self.assertEqual(stats[0].count, 135)
|
self.assertEqual(135, stats[0].count)
|
||||||
|
|
||||||
def test_list_by_meter_name_with_groupby(self):
|
def test_list_by_meter_name_with_groupby(self):
|
||||||
stats = list(self.mgr.list(meter_name='instance',
|
stats = list(self.mgr.list(meter_name='instance',
|
||||||
@@ -173,11 +173,11 @@ class StatisticsManagerTest(utils.BaseTestCase):
|
|||||||
'%s?%s%s' % (base_url, qry, groupby)
|
'%s?%s%s' % (base_url, qry, groupby)
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(stats), 2)
|
self.assertEqual(2, len(stats))
|
||||||
self.assertEqual(stats[0].count, 135)
|
self.assertEqual(135, stats[0].count)
|
||||||
self.assertEqual(stats[1].count, 12)
|
self.assertEqual(12, stats[1].count)
|
||||||
self.assertEqual(stats[0].groupby.get('resource_id'), 'foo')
|
self.assertEqual('foo', stats[0].groupby.get('resource_id'))
|
||||||
self.assertEqual(stats[1].groupby.get('resource_id'), 'bar')
|
self.assertEqual('bar', stats[1].groupby.get('resource_id'))
|
||||||
|
|
||||||
def test_list_by_meter_name_with_groupby_as_str(self):
|
def test_list_by_meter_name_with_groupby_as_str(self):
|
||||||
stats = list(self.mgr.list(meter_name='instance',
|
stats = list(self.mgr.list(meter_name='instance',
|
||||||
|
@@ -46,7 +46,7 @@ class TraitDescriptionManagerTest(utils.BaseTestCase):
|
|||||||
'GET', '/v2/event_types/Foo/traits'
|
'GET', '/v2/event_types/Foo/traits'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(trait_descriptions), 3)
|
self.assertEqual(3, len(trait_descriptions))
|
||||||
for i, vals in enumerate([('trait_1', 'string'),
|
for i, vals in enumerate([('trait_1', 'string'),
|
||||||
('trait_2', 'integer'),
|
('trait_2', 'integer'),
|
||||||
('trait_3', 'datetime')]):
|
('trait_3', 'datetime')]):
|
||||||
|
@@ -48,7 +48,7 @@ class TraitManagerTest(utils.BaseTestCase):
|
|||||||
'GET', '/v2/event_types/Foo/traits/trait_1'
|
'GET', '/v2/event_types/Foo/traits/trait_1'
|
||||||
]
|
]
|
||||||
self.http_client.assert_called(*expect)
|
self.http_client.assert_called(*expect)
|
||||||
self.assertEqual(len(traits), 2)
|
self.assertEqual(2, len(traits))
|
||||||
for i, vals in enumerate([('trait_1',
|
for i, vals in enumerate([('trait_1',
|
||||||
'datetime',
|
'datetime',
|
||||||
'2014-01-07T17:22:10.925553'),
|
'2014-01-07T17:22:10.925553'),
|
||||||
|
@@ -1108,7 +1108,7 @@ def do_resource_show(cc, args={}):
|
|||||||
|
|
||||||
@utils.arg('-q', '--query', metavar='<QUERY>',
|
@utils.arg('-q', '--query', metavar='<QUERY>',
|
||||||
help='key[op]data_type::value; list. data_type is optional, '
|
help='key[op]data_type::value; list. data_type is optional, '
|
||||||
'but if supplied must be string, integer, float'
|
'but if supplied must be string, integer, float '
|
||||||
'or datetime.')
|
'or datetime.')
|
||||||
@utils.arg('--no-traits', dest='no_traits', action='store_true',
|
@utils.arg('--no-traits', dest='no_traits', action='store_true',
|
||||||
help='If specified, traits will not be printed.')
|
help='If specified, traits will not be printed.')
|
||||||
|
11
debian/changelog
vendored
11
debian/changelog
vendored
@@ -1,4 +1,4 @@
|
|||||||
python-ceilometerclient (2.5.0-1) UNRELEASED; urgency=medium
|
python-ceilometerclient (2.6.1-1) experimental; urgency=medium
|
||||||
|
|
||||||
[ Ondřej Nový ]
|
[ Ondřej Nový ]
|
||||||
* Standards-Version is 3.9.8 now (no change)
|
* Standards-Version is 3.9.8 now (no change)
|
||||||
@@ -10,10 +10,15 @@ python-ceilometerclient (2.5.0-1) UNRELEASED; urgency=medium
|
|||||||
* .gitreview: Copy from orig tar file.
|
* .gitreview: Copy from orig tar file.
|
||||||
* d/gbp.conf: Update debian-branch for Newton.
|
* d/gbp.conf: Update debian-branch for Newton.
|
||||||
* d/control: Align (Build-)Depends with upstream.
|
* d/control: Align (Build-)Depends with upstream.
|
||||||
* d/p/skip-tests.patch: Rebased.
|
|
||||||
* ceilometerclient/v2/client.py: Copy from orig tar file.
|
* ceilometerclient/v2/client.py: Copy from orig tar file.
|
||||||
|
|
||||||
-- Corey Bryant <corey.bryant@canonical.com> Wed, 03 Aug 2016 16:20:56 -0400
|
[ Thomas Goirand ]
|
||||||
|
* New upstream release.
|
||||||
|
* Using pkgos-dh_auto_{install,test} from openstack-pkg-tools >= 52~.
|
||||||
|
* Using OpenStack's Gerrit as VCS URLs.
|
||||||
|
* d/p/skip-tests.patch: deleted.
|
||||||
|
|
||||||
|
-- Thomas Goirand <zigo@debian.org> Tue, 13 Sep 2016 09:48:32 +0200
|
||||||
|
|
||||||
python-ceilometerclient (2.4.0-2) unstable; urgency=medium
|
python-ceilometerclient (2.4.0-2) unstable; urgency=medium
|
||||||
|
|
||||||
|
6
debian/control
vendored
6
debian/control
vendored
@@ -6,7 +6,7 @@ Uploaders: Thomas Goirand <zigo@debian.org>,
|
|||||||
Corey Bryant <corey.bryant@canonical.com>,
|
Corey Bryant <corey.bryant@canonical.com>,
|
||||||
Build-Depends: debhelper (>= 9),
|
Build-Depends: debhelper (>= 9),
|
||||||
dh-python,
|
dh-python,
|
||||||
openstack-pkg-tools,
|
openstack-pkg-tools (>= 52~),
|
||||||
python-all,
|
python-all,
|
||||||
python-pbr (>= 1.8),
|
python-pbr (>= 1.8),
|
||||||
python-setuptools,
|
python-setuptools,
|
||||||
@@ -48,8 +48,8 @@ Build-Depends-Indep: python-coverage,
|
|||||||
subunit,
|
subunit,
|
||||||
testrepository,
|
testrepository,
|
||||||
Standards-Version: 3.9.8
|
Standards-Version: 3.9.8
|
||||||
Vcs-Browser: https://anonscm.debian.org/cgit/openstack/python-ceilometerclient.git/
|
Vcs-Browser: https://git.openstack.org/cgit/openstack/deb-python-ceilometerclient
|
||||||
Vcs-Git: https://anonscm.debian.org/git/openstack/python-ceilometerclient.git
|
Vcs-Git: https://git.openstack.org/openstack/deb-python-ceilometerclient
|
||||||
Homepage: http://www.openstack.org
|
Homepage: http://www.openstack.org
|
||||||
XS-Testsuite: autopkgtest
|
XS-Testsuite: autopkgtest
|
||||||
|
|
||||||
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@@ -1 +0,0 @@
|
|||||||
skip-tests.patch
|
|
26
debian/patches/skip-tests.patch
vendored
26
debian/patches/skip-tests.patch
vendored
@@ -1,26 +0,0 @@
|
|||||||
Description: Skip test that fails due to upstream bug
|
|
||||||
https://bugs.launchpad.net/python-ceilometerclient/+bug/1552286
|
|
||||||
Author: Corey Bryant <corey.bryant@canonical.com>
|
|
||||||
Forwarded: no
|
|
||||||
|
|
||||||
--- a/ceilometerclient/tests/unit/v2/test_shell.py
|
|
||||||
+++ b/ceilometerclient/tests/unit/v2/test_shell.py
|
|
||||||
@@ -538,7 +538,8 @@
|
|
||||||
ceilometer_shell.\
|
|
||||||
do_alarm_gnocchi_aggregation_by_metrics_threshold_create(
|
|
||||||
self.cc, self.args)
|
|
||||||
- self.assertEqual('''\
|
|
||||||
+ try:
|
|
||||||
+ self.assertEqual('''\
|
|
||||||
+---------------------------+------------------------------------------\
|
|
||||||
--------------------------+
|
|
||||||
| Property | Value \
|
|
||||||
@@ -604,6 +605,8 @@
|
|
||||||
+---------------------------+------------------------------------------\
|
|
||||||
--------------------------+
|
|
||||||
''', sys.stdout.getvalue())
|
|
||||||
+ except:
|
|
||||||
+ self.skipTest("Skipped by Debian")
|
|
||||||
|
|
||||||
@mock.patch('sys.stdout', new=six.StringIO())
|
|
||||||
def test_do_alarm_gnocchi_aggr_by_resources_threshold_create(self):
|
|
44
debian/rules
vendored
44
debian/rules
vendored
@@ -1,46 +1,32 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
PYTHONS:=$(shell pyversions -vr)
|
|
||||||
PYTHON3S:=$(shell py3versions -vr)
|
|
||||||
|
|
||||||
MANIFEST_EXCLUDE_STANDARD := ceilometerclient
|
MANIFEST_EXCLUDE_STANDARD := ceilometerclient
|
||||||
|
|
||||||
include /usr/share/openstack-pkg-tools/pkgos.make
|
include /usr/share/openstack-pkg-tools/pkgos.make
|
||||||
|
|
||||||
export OSLO_PACKAGE_VERSION=$(VERSION)
|
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --buildsystem=python_distutils --with python2,python3,sphinxdoc
|
dh $@ --buildsystem=python_distutils --with python2,python3,sphinxdoc
|
||||||
|
|
||||||
override_dh_install:
|
override_dh_auto_install:
|
||||||
set -e ; for pyvers in $(PYTHONS); do \
|
pkgos-dh_auto_install
|
||||||
python$$pyvers setup.py install --install-layout=deb \
|
|
||||||
--root $(CURDIR)/debian/python-ceilometerclient; \
|
|
||||||
done
|
|
||||||
set -e ; for pyvers in $(PYTHON3S); do \
|
|
||||||
python$$pyvers setup.py install --install-layout=deb \
|
|
||||||
--root $(CURDIR)/debian/python3-ceilometerclient; \
|
|
||||||
done
|
|
||||||
mv $(CURDIR)/debian/python-ceilometerclient/usr/bin/ceilometer $(CURDIR)/debian/python-ceilometerclient/usr/bin/python2-ceilometer
|
|
||||||
mv $(CURDIR)/debian/python3-ceilometerclient/usr/bin/ceilometer $(CURDIR)/debian/python3-ceilometerclient/usr/bin/python3-ceilometer
|
|
||||||
|
|
||||||
override_dh_python3:
|
override_dh_python3:
|
||||||
dh_python3 --shebang=/usr/bin/python3
|
dh_python3 --shebang=/usr/bin/python3
|
||||||
|
|
||||||
override_dh_auto_test:
|
override_dh_auto_test:
|
||||||
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
|
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
|
||||||
@echo "===> Running tests"
|
pkgos-dh_auto_test
|
||||||
set -e ; set -x ; for i in $(PYTHONS) $(PYTHON3S) ; do \
|
# @echo "===> Running tests"
|
||||||
PYMAJOR=`echo $$i | cut -d'.' -f1` ; \
|
# set -e ; set -x ; for i in $(PYTHONS) $(PYTHON3S) ; do \
|
||||||
echo "===> Testing with python$$i (python$$PYMAJOR)" ; \
|
# PYMAJOR=`echo $$i | cut -d'.' -f1` ; \
|
||||||
rm -rf .testrepository ; \
|
# echo "===> Testing with python$$i (python$$PYMAJOR)" ; \
|
||||||
testr-python$$PYMAJOR init ; \
|
# rm -rf .testrepository ; \
|
||||||
TEMP_REZ=`mktemp -t` ; \
|
# testr-python$$PYMAJOR init ; \
|
||||||
PYTHONPATH=$(CURDIR) PYTHON=python$$i testr-python$$PYMAJOR run --subunit 'ceilometerclient\.tests\.unit\.(?!.*test_client.ClientAuthTest\.test_discover_auth_versions.*)' | tee $$TEMP_REZ | subunit2pyunit ; \
|
# TEMP_REZ=`mktemp -t` ; \
|
||||||
cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
|
# PYTHONPATH=$(CURDIR) PYTHON=python$$i testr-python$$PYMAJOR run --subunit 'ceilometerclient\.tests\.unit\.(?!.*test_client.ClientAuthTest\.test_discover_auth_versions.*)' | tee $$TEMP_REZ | subunit2pyunit ; \
|
||||||
rm -f $$TEMP_REZ ; \
|
# cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
|
||||||
testr-python$$PYMAJOR slowest ; \
|
# rm -f $$TEMP_REZ ; \
|
||||||
done
|
# testr-python$$PYMAJOR slowest ; \
|
||||||
|
# done
|
||||||
endif
|
endif
|
||||||
|
|
||||||
override_dh_sphinxdoc:
|
override_dh_sphinxdoc:
|
||||||
|
@@ -8,7 +8,6 @@ oslo.i18n>=2.1.0 # Apache-2.0
|
|||||||
oslo.serialization>=1.10.0 # Apache-2.0
|
oslo.serialization>=1.10.0 # Apache-2.0
|
||||||
oslo.utils>=3.5.0 # Apache-2.0
|
oslo.utils>=3.5.0 # Apache-2.0
|
||||||
PrettyTable<0.8,>=0.7 # BSD
|
PrettyTable<0.8,>=0.7 # BSD
|
||||||
python-keystoneclient!=1.8.0,!=2.1.0,>=1.6.0 # Apache-2.0
|
|
||||||
requests!=2.9.0,>=2.8.1 # Apache-2.0
|
requests!=2.9.0,>=2.8.1 # Apache-2.0
|
||||||
six>=1.9.0 # MIT
|
six>=1.9.0 # MIT
|
||||||
stevedore>=1.10.0 # Apache-2.0
|
stevedore>=1.10.0 # Apache-2.0
|
||||||
|
@@ -17,6 +17,7 @@ classifier =
|
|||||||
Programming Language :: Python :: 2.7
|
Programming Language :: Python :: 2.7
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3.4
|
Programming Language :: Python :: 3.4
|
||||||
|
Programming Language :: Python :: 3.5
|
||||||
|
|
||||||
[files]
|
[files]
|
||||||
packages =
|
packages =
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
# process, which may cause wedges in the gate later.
|
# process, which may cause wedges in the gate later.
|
||||||
# Hacking already pins down pep8, pyflakes and flake8
|
# Hacking already pins down pep8, pyflakes and flake8
|
||||||
coverage>=3.6 # Apache-2.0
|
coverage>=3.6 # Apache-2.0
|
||||||
discover # BSD
|
|
||||||
fixtures<2.0,>=1.3.1 # Apache-2.0/BSD
|
fixtures<2.0,>=1.3.1 # Apache-2.0/BSD
|
||||||
mock>=1.2 # BSD
|
mock>=1.2 # BSD
|
||||||
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
|
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
|
||||||
|
Reference in New Issue
Block a user