Merge "Replace jsonutils by ujson"
This commit is contained in:
commit
995abb6341
@ -23,12 +23,12 @@ import uuid
|
||||
from gnocchiclient import exceptions as gnocchi_exc
|
||||
from keystoneauth1 import exceptions as ka_exceptions
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import fnmatch
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
from stevedore import extension
|
||||
import ujson
|
||||
|
||||
from ceilometer import declarative
|
||||
from ceilometer import gnocchi_client
|
||||
@ -502,7 +502,7 @@ class GnocchiPublisher(publisher.ConfigPublisherBase):
|
||||
def _search_resource(self, resource_type, query):
|
||||
try:
|
||||
return self._gnocchi.resource.search(
|
||||
resource_type, jsonutils.loads(query))
|
||||
resource_type, ujson.loads(query))
|
||||
except Exception:
|
||||
LOG.error("Fail to search resource type %{resource_type}s "
|
||||
"with '%{query}s'",
|
||||
|
@ -14,11 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import strutils
|
||||
import requests
|
||||
from requests import adapters
|
||||
from six.moves.urllib import parse as urlparse
|
||||
import ujson
|
||||
|
||||
from ceilometer import publisher
|
||||
|
||||
@ -154,7 +154,7 @@ class HttpPublisher(publisher.ConfigPublisherBase):
|
||||
if not data:
|
||||
LOG.debug('Data set is empty!')
|
||||
return
|
||||
data = jsonutils.dumps(data)
|
||||
data = ujson.dumps(data)
|
||||
LOG.trace('Message: %s', data)
|
||||
try:
|
||||
res = self.session.post(self.target, data=data,
|
||||
|
@ -260,5 +260,5 @@ class TestHttpPublisher(base.BaseTestCase):
|
||||
with mock.patch.object(requests.Session, 'post') as post:
|
||||
publisher.publish_events(self.event_data)
|
||||
self.assertEqual(
|
||||
'[{"some": "aa"}, {"some": "aa"}, {"some": "aa"}]',
|
||||
'[{"some":"aa"},{"some":"aa"},{"some":"aa"}]',
|
||||
post.call_args[1]['data'])
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
"""Tests for ceilometer/publisher/utils.py
|
||||
"""
|
||||
from oslo_serialization import jsonutils
|
||||
from oslotest import base
|
||||
import ujson
|
||||
|
||||
from ceilometer.publisher import utils
|
||||
|
||||
@ -104,7 +104,7 @@ class TestSignature(base.BaseTestCase):
|
||||
data['message_signature'] = utils.compute_signature(
|
||||
data,
|
||||
'not-so-secret')
|
||||
jsondata = jsonutils.loads(jsonutils.dumps(data))
|
||||
jsondata = ujson.loads(ujson.dumps(data))
|
||||
self.assertTrue(utils.verify_signature(jsondata, 'not-so-secret'))
|
||||
|
||||
def test_verify_unicode_symbols(self):
|
||||
@ -114,7 +114,7 @@ class TestSignature(base.BaseTestCase):
|
||||
data['message_signature'] = utils.compute_signature(
|
||||
data,
|
||||
'not-so-secret')
|
||||
jsondata = jsonutils.loads(jsonutils.dumps(data))
|
||||
jsondata = ujson.loads(ujson.dumps(data))
|
||||
self.assertTrue(utils.verify_signature(jsondata, 'not-so-secret'))
|
||||
|
||||
def test_verify_no_secret(self):
|
||||
|
@ -21,7 +21,7 @@ oslo.reports>=0.6.0 # Apache-2.0
|
||||
oslo.rootwrap>=2.0.0 # Apache-2.0
|
||||
pbr>=1.6 # Apache-2.0
|
||||
oslo.messaging>=5.12.0 # Apache-2.0
|
||||
oslo.serialization>=1.10.0 # Apache-2.0
|
||||
ujson
|
||||
oslo.utils>=3.5.0 # Apache-2.0
|
||||
pysnmp<5.0.0,>=4.2.3 # BSD
|
||||
python-glanceclient>=2.0.0 # Apache-2.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user