2014-09-01 12:27:30 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'cinder::logging' do
|
|
|
|
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
let :log_params do
|
|
|
|
{
|
|
|
|
:logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
|
|
|
|
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
|
|
|
|
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
|
|
|
|
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
|
|
|
|
:log_config_append => '/etc/cinder/logging.conf',
|
|
|
|
:publish_errors => true,
|
|
|
|
:default_log_levels => {
|
|
|
|
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
|
|
|
|
'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
|
|
|
|
'iso8601' => 'WARN',
|
|
|
|
'requests.packages.urllib3.connectionpool' => 'WARN' },
|
|
|
|
:fatal_deprecations => true,
|
|
|
|
:instance_format => '[instance: %(uuid)s] ',
|
|
|
|
:instance_uuid_format => '[instance: %(uuid)s] ',
|
|
|
|
:log_date_format => '%Y-%m-%d %H:%M:%S',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples_for 'cinder-logging' do
|
|
|
|
|
|
|
|
context 'with extended logging options' do
|
|
|
|
before { params.merge!( log_params ) }
|
|
|
|
it_configures 'logging params set'
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples_for 'logging params set' do
|
|
|
|
it 'enables logging params' do
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/logging_context_format_string').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s')
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/logging_default_format_string').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s')
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/logging_debug_format_suffix').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'%(funcName)s %(pathname)s:%(lineno)d')
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/logging_exception_prefix').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s')
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/log_config_append').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'/etc/cinder/logging.conf')
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/publish_errors').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
true)
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/default_log_levels').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,qpid=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO')
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/fatal_deprecations').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
true)
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/instance_format').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'[instance: %(uuid)s] ')
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/instance_uuid_format').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'[instance: %(uuid)s] ')
|
|
|
|
|
2015-02-22 22:29:32 +01:00
|
|
|
is_expected.to contain_cinder_config('DEFAULT/log_date_format').with_value(
|
2014-09-01 12:27:30 +00:00
|
|
|
'%Y-%m-%d %H:%M:%S')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on Debian platforms' do
|
|
|
|
let :facts do
|
2015-09-29 13:24:29 -05:00
|
|
|
@default_facts.merge!({ :osfamily => 'Debian' })
|
2014-09-01 12:27:30 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it_configures 'cinder-logging'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on RedHat platforms' do
|
|
|
|
let :facts do
|
2015-09-29 13:24:29 -05:00
|
|
|
@default_facts.merge!({ :osfamily => 'RedHat' })
|
2014-09-01 12:27:30 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it_configures 'cinder-logging'
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|