Set publish_errors default to False.
This commit is contained in:
@@ -64,7 +64,7 @@ flags.DEFINE_list('default_log_levels',
|
|||||||
'eventlet.wsgi.server=WARN'],
|
'eventlet.wsgi.server=WARN'],
|
||||||
'list of logger=LEVEL pairs')
|
'list of logger=LEVEL pairs')
|
||||||
flags.DEFINE_bool('use_syslog', False, 'output to syslog')
|
flags.DEFINE_bool('use_syslog', False, 'output to syslog')
|
||||||
flags.DEFINE_bool('publish_errors', True, 'publish error events')
|
flags.DEFINE_bool('publish_errors', False, 'publish error events')
|
||||||
flags.DEFINE_string('logfile', None, 'output to named file')
|
flags.DEFINE_string('logfile', None, 'output to named file')
|
||||||
|
|
||||||
|
|
||||||
|
@@ -18,14 +18,12 @@ import json
|
|||||||
import stubout
|
import stubout
|
||||||
|
|
||||||
import nova
|
import nova
|
||||||
from nova import log as logging
|
from nova import log
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import notifier
|
from nova import notifier
|
||||||
from nova.notifier import no_op_notifier
|
from nova.notifier import no_op_notifier
|
||||||
from nova import test
|
from nova import test
|
||||||
|
|
||||||
LOG = logging.getLogger('nova.compute.api')
|
|
||||||
|
|
||||||
class NotifierTestCase(test.TestCase):
|
class NotifierTestCase(test.TestCase):
|
||||||
"""Test case for notifications"""
|
"""Test case for notifications"""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -66,12 +64,17 @@ class NotifierTestCase(test.TestCase):
|
|||||||
def test_error_notification(self):
|
def test_error_notification(self):
|
||||||
self.stubs.Set(nova.flags.FLAGS, 'notification_driver',
|
self.stubs.Set(nova.flags.FLAGS, 'notification_driver',
|
||||||
'nova.notifier.rabbit_notifier.RabbitNotifier')
|
'nova.notifier.rabbit_notifier.RabbitNotifier')
|
||||||
|
self.stubs.Set(nova.flags.FLAGS, 'publish_errors', True)
|
||||||
|
LOG = log.getLogger('nova')
|
||||||
|
LOG.setup_from_flags()
|
||||||
|
|
||||||
msgs = []
|
msgs = []
|
||||||
def mock_cast(context, topic, msg):
|
def mock_cast(context, topic, msg):
|
||||||
data = json.loads(msg)
|
data = json.loads(msg)
|
||||||
msgs.append(data)
|
msgs.append(data)
|
||||||
self.stubs.Set(nova.rpc, 'cast', mock_cast)
|
self.stubs.Set(nova.rpc, 'cast', mock_cast)
|
||||||
LOG.error('foo');
|
LOG.error('foo');
|
||||||
|
self.assertEqual(1, len(msgs))
|
||||||
msg = msgs[0]
|
msg = msgs[0]
|
||||||
self.assertEqual(msg['event_name'], 'error')
|
self.assertEqual(msg['event_name'], 'error')
|
||||||
self.assertEqual(msg['model']['msg'], 'foo')
|
self.assertEqual(msg['model']['msg'], 'foo')
|
||||||
|
Reference in New Issue
Block a user