Update oslo::concurrency define
* Fix docs for parameters * Use only one call of "create_resources" * Prepare unit tests Change-Id: I6d57d0ddc18dc92caad6fe311617a71a7faa13dd
This commit is contained in:
parent
415e4ba734
commit
5321163380
@ -8,20 +8,23 @@
|
||||
# === Parameters:
|
||||
#
|
||||
# [*disable_process_locking*]
|
||||
# (Optional) Enables or disables inter-process locks.
|
||||
# (Optional) Enables or disables inter-process locks. (boolean value)
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*lock_path*]
|
||||
# (Optional) Directory to use for lock files. For security, the specified directory
|
||||
# should only be writable by the user running the processes that need locking.
|
||||
# If external locks are used, a lock path must be set.
|
||||
# If external locks are used, a lock path must be set. (string value)
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
define oslo::concurrency(
|
||||
$disable_process_locking = $::os_service_default,
|
||||
$lock_path = $::os_service_default,
|
||||
) {
|
||||
create_resources($name, {'oslo_concurrency/disable_process_locking' => { value => $disable_process_locking }})
|
||||
create_resources($name, {'oslo_concurrency/lock_path' => { value => $lock_path }})
|
||||
}
|
||||
$concurrency_options = {
|
||||
'oslo_concurrency/disable_process_locking' => { value => $disable_process_locking },
|
||||
'oslo_concurrency/lock_path' => { value => $lock_path }
|
||||
}
|
||||
|
||||
create_resources($name, $concurrency_options)
|
||||
}
|
||||
|
42
spec/defines/oslo_concurrency_spec.rb
Normal file
42
spec/defines/oslo_concurrency_spec.rb
Normal file
@ -0,0 +1,42 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'oslo::concurrency' do
|
||||
|
||||
let (:title) { 'keystone_config' }
|
||||
|
||||
shared_examples 'shared examples' do
|
||||
|
||||
context 'with default parameters' do
|
||||
it 'configures oslo_concurrency default params' do
|
||||
is_expected.to contain_keystone_config('oslo_concurrency/disable_process_locking').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_keystone_config('oslo_concurrency/lock_path').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with overridden parameters' do
|
||||
let :params do
|
||||
{
|
||||
:disable_process_locking => 'true',
|
||||
:lock_path => '/lock/dir/',
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures oslo_concurrency section' do
|
||||
is_expected.to contain_keystone_config('oslo_concurrency/disable_process_locking').with_value('true')
|
||||
is_expected.to contain_keystone_config('oslo_concurrency/lock_path').with_value('/lock/dir/')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'shared examples'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user