oslo log: check puppet resource instead of actual config in spec
Change-Id: I37e4bd67d2c4937b557d6efdd75799559136ea1f
This commit is contained in:
		| @@ -16,10 +16,9 @@ describe 'cloudkitty::logging' do | |||||||
|       :log_config_append => '/etc/cloudkitty/logging.conf', |       :log_config_append => '/etc/cloudkitty/logging.conf', | ||||||
|       :publish_errors => true, |       :publish_errors => true, | ||||||
|       :default_log_levels => { |       :default_log_levels => { | ||||||
|         'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN', |           'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN', | ||||||
|         'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO', |           'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN', | ||||||
|         'iso8601' => 'WARN', |           'requests.packages.urllib3.connectionpool' => 'WARN' }, | ||||||
|         'requests.packages.urllib3.connectionpool' => 'WARN' }, |  | ||||||
|      :fatal_deprecations => true, |      :fatal_deprecations => true, | ||||||
|      :instance_format => '[instance: %(uuid)s] ', |      :instance_format => '[instance: %(uuid)s] ', | ||||||
|      :instance_uuid_format => '[instance: %(uuid)s] ', |      :instance_uuid_format => '[instance: %(uuid)s] ', | ||||||
| @@ -28,7 +27,7 @@ describe 'cloudkitty::logging' do | |||||||
|      :use_stderr => false, |      :use_stderr => false, | ||||||
|      :syslog_log_facility => 'LOG_FOO', |      :syslog_log_facility => 'LOG_FOO', | ||||||
|      :log_dir => '/var/log', |      :log_dir => '/var/log', | ||||||
|      :log_file => '/var/log/cloudkitty.log', |      :log_file => '/var/tmp/cloudkitty_random.log', | ||||||
|      :debug => true, |      :debug => true, | ||||||
|     } |     } | ||||||
|   end |   end | ||||||
| @@ -57,63 +56,52 @@ describe 'cloudkitty::logging' do | |||||||
|  |  | ||||||
|   shared_examples 'basic default logging settings' do |   shared_examples 'basic default logging settings' do | ||||||
|     it 'configures cloudkitty logging settings with default values' do |     it 'configures cloudkitty logging settings with default values' do | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/use_syslog').with(:value => '<SERVICE DEFAULT>') |       is_expected.to contain_oslo__log('cloudkitty_config').with( | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/use_stderr').with(:value => '<SERVICE DEFAULT>') |         :use_syslog          => '<SERVICE DEFAULT>', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/syslog_log_facility').with(:value => '<SERVICE DEFAULT>') |         :use_stderr          => '<SERVICE DEFAULT>', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/log_dir').with(:value => '/var/log/cloudkitty') |         :syslog_log_facility => '<SERVICE DEFAULT>', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/log_file').with(:value => '<SERVICE DEFAULT>') |         :log_dir             => '/var/log/cloudkitty', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/debug').with(:value => '<SERVICE DEFAULT>') |         :log_file            => '<SERVICE DEFAULT>', | ||||||
|  |         :debug               => '<SERVICE DEFAULT>', | ||||||
|  |       ) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   shared_examples 'basic non-default logging settings' do |   shared_examples 'basic non-default logging settings' do | ||||||
|     it 'configures cloudkitty logging settings with non-default values' do |     it 'configures cloudkitty logging settings with non-default values' do | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/use_syslog').with(:value => 'true') |       is_expected.to contain_oslo__log('cloudkitty_config').with( | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/use_stderr').with(:value => 'false') |         :use_syslog          => true, | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_FOO') |         :use_stderr          => false, | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/log_dir').with(:value => '/var/log') |         :syslog_log_facility => 'LOG_FOO', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/log_file').with(:value => '/var/log/cloudkitty.log') |         :log_dir             => '/var/log', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/debug').with(:value => 'true') |         :log_file            => '/var/tmp/cloudkitty_random.log', | ||||||
|  |         :debug               => true, | ||||||
|  |       ) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   shared_examples_for 'logging params set' do |   shared_examples_for 'logging params set' do | ||||||
|     it 'enables logging params' do |     it 'enables logging params' do | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/logging_context_format_string').with_value( |       is_expected.to contain_oslo__log('cloudkitty_config').with( | ||||||
|         '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s') |         :logging_context_format_string => | ||||||
|  |           '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/logging_default_format_string').with_value( |         :logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s', | ||||||
|         '%(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', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/logging_debug_format_suffix').with_value( |         :log_config_append             => '/etc/cloudkitty/logging.conf', | ||||||
|         '%(funcName)s %(pathname)s:%(lineno)d') |         :publish_errors                => true, | ||||||
|  |         :default_log_levels            => { | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/logging_exception_prefix').with_value( |           'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN', | ||||||
|        '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s') |           'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN', | ||||||
|  |           'requests.packages.urllib3.connectionpool' => 'WARN' }, | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/log_config_append').with_value( |        :fatal_deprecations             => true, | ||||||
|         '/etc/cloudkitty/logging.conf') |        :instance_format                => '[instance: %(uuid)s] ', | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/publish_errors').with_value( |        :instance_uuid_format           => '[instance: %(uuid)s] ', | ||||||
|         true) |        :log_date_format                => '%Y-%m-%d %H:%M:%S', | ||||||
|  |       ) | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/default_log_levels').with_value( |  | ||||||
|         'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,qpid=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO') |  | ||||||
|  |  | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/fatal_deprecations').with_value( |  | ||||||
|         true) |  | ||||||
|  |  | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/instance_format').with_value( |  | ||||||
|         '[instance: %(uuid)s] ') |  | ||||||
|  |  | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/instance_uuid_format').with_value( |  | ||||||
|         '[instance: %(uuid)s] ') |  | ||||||
|  |  | ||||||
|       is_expected.to contain_cloudkitty_config('DEFAULT/log_date_format').with_value( |  | ||||||
|         '%Y-%m-%d %H:%M:%S') |  | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |  | ||||||
|   shared_examples_for 'logging params unset' do |   shared_examples_for 'logging params unset' do | ||||||
|    [ :logging_context_format_string, :logging_default_format_string, |    [ :logging_context_format_string, :logging_default_format_string, | ||||||
|      :logging_debug_format_suffix, :logging_exception_prefix, |      :logging_debug_format_suffix, :logging_exception_prefix, | ||||||
| @@ -121,7 +109,7 @@ describe 'cloudkitty::logging' do | |||||||
|      :default_log_levels, :fatal_deprecations, |      :default_log_levels, :fatal_deprecations, | ||||||
|      :instance_format, :instance_uuid_format, |      :instance_format, :instance_uuid_format, | ||||||
|      :log_date_format, ].each { |param| |      :log_date_format, ].each { |param| | ||||||
|         it { is_expected.to contain_cloudkitty_config("DEFAULT/#{param}").with_value('<SERVICE DEFAULT>') } |         it { is_expected.to contain_oslo__log('cloudkitty_config').with("#{param}" => '<SERVICE DEFAULT>') } | ||||||
|       } |       } | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Mykyta Karpin
					Mykyta Karpin