Merge "oslo log: check puppet resource instead of actual config in spec"

This commit is contained in:
Jenkins 2017-03-10 19:43:22 +00:00 committed by Gerrit Code Review
commit ebcec6da8a

View File

@ -55,56 +55,46 @@ describe 'nova::logging' do
shared_examples 'basic default logging settings' do
it 'configures nova logging settins with default values' do
is_expected.to contain_nova_config('DEFAULT/use_syslog').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/use_stderr').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/log_dir').with(:value => '/var/log/nova')
is_expected.to contain_nova_config('DEFAULT/debug').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_oslo__log('nova_config').with(
:use_syslog => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>',
:log_dir => '/var/log/nova',
:debug => '<SERVICE DEFAULT>',
)
end
end
shared_examples 'basic non-default logging settings' do
it 'configures nova logging settins with non-default values' do
is_expected.to contain_nova_config('DEFAULT/use_syslog').with(:value => 'true')
is_expected.to contain_nova_config('DEFAULT/use_stderr').with(:value => 'false')
is_expected.to contain_nova_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_FOO')
is_expected.to contain_nova_config('DEFAULT/log_dir').with(:value => '/var/log')
is_expected.to contain_nova_config('DEFAULT/debug').with(:value => 'true')
is_expected.to contain_oslo__log('nova_config').with(
:use_syslog => true,
:use_stderr => false,
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:debug => true,
)
end
end
shared_examples_for 'logging params set' do
it 'enables logging params' do
is_expected.to contain_nova_config('DEFAULT/logging_context_format_string').with_value(
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s')
is_expected.to contain_nova_config('DEFAULT/logging_default_format_string').with_value(
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s')
is_expected.to contain_nova_config('DEFAULT/logging_debug_format_suffix').with_value(
'%(funcName)s %(pathname)s:%(lineno)d')
is_expected.to contain_nova_config('DEFAULT/logging_exception_prefix').with_value(
'%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s')
is_expected.to contain_nova_config('DEFAULT/log_config_append').with_value(
'/etc/nova/logging.conf')
is_expected.to contain_nova_config('DEFAULT/publish_errors').with_value(
true)
is_expected.to contain_nova_config('DEFAULT/default_log_levels').with_value(
'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO')
is_expected.to contain_nova_config('DEFAULT/fatal_deprecations').with_value(
true)
is_expected.to contain_nova_config('DEFAULT/instance_format').with_value(
'[instance: %(uuid)s] ')
is_expected.to contain_nova_config('DEFAULT/instance_uuid_format').with_value(
'[instance: %(uuid)s] ')
is_expected.to contain_nova_config('DEFAULT/log_date_format').with_value(
'%Y-%m-%d %H:%M:%S')
is_expected.to contain_oslo__log('nova_config').with(
: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/nova/logging.conf',
:publish_errors => true,
:default_log_levels => {
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => '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
end
@ -116,7 +106,7 @@ describe 'nova::logging' do
:default_log_levels, :fatal_deprecations,
:instance_format, :instance_uuid_format,
:log_date_format, ].each { |param|
it { is_expected.to contain_nova_config("DEFAULT/#{param}").with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_oslo__log('nova_config').with("#{param}" => '<SERVICE DEFAULT>') }
}
end