Add api_workers into config and change to use engine_workers

Change-Id: I989487609a8f95b152e5b122ec75d7c59e49cf52
This commit is contained in:
rocky 2017-09-07 18:33:58 +10:00 committed by Rocky
parent 6ab2fdc826
commit f2870f3539
5 changed files with 17 additions and 5 deletions

View File

@ -24,12 +24,17 @@
# (Optional) Port on which murano api should listen
# Defaults to $::os_service_default.
#
# [*workers*]
# (Optional) Number of workers for Murano Api
# Defaults to $::os_workers
#
class murano::api(
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$host = $::os_service_default,
$port = $::os_service_default,
$workers = $::os_workers,
) {
include ::murano::deps
@ -47,6 +52,7 @@ class murano::api(
murano_config {
'DEFAULT/bind_host': value => $host;
'DEFAULT/bind_port': value => $port;
'murano/api_workers': value => $workers;
}
package { 'murano-api':

View File

@ -40,7 +40,7 @@ class murano::engine(
}
murano_config {
'engine/workers': value => $workers;
'engine/engine_workers': value => $workers;
}
package { 'murano-engine':

View File

@ -0,0 +1,3 @@
---
features:
- Add new parameter "workers" for api, the number of murano-api workers.

View File

@ -8,15 +8,18 @@ describe 'murano::api' do
context 'with default params' do
it { is_expected.to contain_murano_config('DEFAULT/bind_host').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_murano_config('DEFAULT/bind_port').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_murano_config('murano/api_workers').with_value(facts[:os_workers]) }
end
context 'with passed params' do
let :params do {
:host => 'localhost',
:port => '1111',
:host => 'localhost',
:port => '1111',
:workers => '4',
} end
it { is_expected.to contain_murano_config('DEFAULT/bind_host').with_value('localhost') }
it { is_expected.to contain_murano_config('DEFAULT/bind_port').with_value('1111') }
it { is_expected.to contain_murano_config('murano/api_workers').with_value('4') }
end
end

View File

@ -6,14 +6,14 @@ describe 'murano::engine' do
it { is_expected.to contain_class('murano::engine') }
context 'with default params' do
it { is_expected.to contain_murano_config('engine/workers').with_value('2') }
it { is_expected.to contain_murano_config('engine/engine_workers').with_value(facts[:os_workers]) }
end
context 'with passed workers' do
let :params do {
:workers => '4',
} end
it { is_expected.to contain_murano_config('engine/workers').with_value('4') }
it { is_expected.to contain_murano_config('engine/engine_workers').with_value('4') }
end
end