Merge "Fix the default rpc policy value"
This commit is contained in:
commit
d6a5c90c86
@ -118,7 +118,7 @@ class RPCPublisher(publisher.PublisherBase):
|
||||
|
||||
self.target = options.get('target', ['record_metering_data'])[0]
|
||||
|
||||
self.policy = options.get('policy', ['wait'])[-1]
|
||||
self.policy = options.get('policy', ['default'])[-1]
|
||||
self.max_queue_length = int(options.get(
|
||||
'max_queue_length', [1024])[-1])
|
||||
|
||||
|
@ -19,9 +19,11 @@
|
||||
"""Tests for ceilometer/publish.py
|
||||
"""
|
||||
|
||||
import eventlet
|
||||
import datetime
|
||||
|
||||
import eventlet
|
||||
import mock
|
||||
|
||||
from ceilometer import sample
|
||||
from ceilometer.openstack.common import jsonutils
|
||||
from ceilometer.openstack.common import network_utils
|
||||
@ -296,10 +298,13 @@ class TestPublish(test.BaseTestCase):
|
||||
self.assertEqual(len(self.published), 2)
|
||||
self.assertEqual(len(publisher.local_queue), 0)
|
||||
|
||||
def test_published_with_no_policy(self):
|
||||
@mock.patch('ceilometer.publisher.rpc.LOG')
|
||||
def test_published_with_no_policy(self, mylog):
|
||||
self.rpc_unreachable = True
|
||||
publisher = rpc.RPCPublisher(
|
||||
network_utils.urlsplit('rpc://'))
|
||||
self.assertTrue(mylog.info.called)
|
||||
|
||||
self.assertRaises(
|
||||
SystemExit,
|
||||
publisher.publish_samples,
|
||||
@ -308,10 +313,12 @@ class TestPublish(test.BaseTestCase):
|
||||
self.assertEqual(len(self.published), 0)
|
||||
self.assertEqual(len(publisher.local_queue), 0)
|
||||
|
||||
def test_published_with_policy_block(self):
|
||||
@mock.patch('ceilometer.publisher.rpc.LOG')
|
||||
def test_published_with_policy_block(self, mylog):
|
||||
self.rpc_unreachable = True
|
||||
publisher = rpc.RPCPublisher(
|
||||
network_utils.urlsplit('rpc://?policy=default'))
|
||||
self.assertTrue(mylog.info.called)
|
||||
self.assertRaises(
|
||||
SystemExit,
|
||||
publisher.publish_samples,
|
||||
@ -319,7 +326,8 @@ class TestPublish(test.BaseTestCase):
|
||||
self.assertEqual(len(self.published), 0)
|
||||
self.assertEqual(len(publisher.local_queue), 0)
|
||||
|
||||
def test_published_with_policy_incorrect(self):
|
||||
@mock.patch('ceilometer.publisher.rpc.LOG')
|
||||
def test_published_with_policy_incorrect(self, mylog):
|
||||
self.rpc_unreachable = True
|
||||
publisher = rpc.RPCPublisher(
|
||||
network_utils.urlsplit('rpc://?policy=notexist'))
|
||||
@ -327,6 +335,7 @@ class TestPublish(test.BaseTestCase):
|
||||
SystemExit,
|
||||
publisher.publish_samples,
|
||||
None, self.test_data)
|
||||
self.assertTrue(mylog.warn.called)
|
||||
self.assertEqual(publisher.policy, 'default')
|
||||
self.assertEqual(len(self.published), 0)
|
||||
self.assertEqual(len(publisher.local_queue), 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user