Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #34824 - properly restart foreman when puma config changed #1045

Merged
merged 1 commit into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
}

service { $foreman_service:
ensure => $foreman_service_ensure,
enable => $foreman_service_enable,
require => Service["${foreman_service}.socket"],
ensure => $foreman_service_ensure,
enable => $foreman_service_enable,
before => Service["${foreman_service}.socket"],
}
}
45 changes: 45 additions & 0 deletions spec/acceptance/foreman_service_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
require 'spec_helper_acceptance'

describe 'configures puma worker count', :order => :defined do
context 'initial configuration with 2 puma workers' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'foreman':
foreman_service_puma_workers => 2,
}
PUPPET
end
end

describe service("foreman") do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end

describe process('puma: cluster worker') do
evgeni marked this conversation as resolved.
Show resolved Hide resolved
its(:count) { is_expected.to eq 2 }
end
end

context 'reconfigure to use 1 puma worker and restart foreman.service' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'foreman':
foreman_service_puma_workers => 1,
}
PUPPET
end
end

describe service("foreman") do
it { is_expected.to be_enabled }
it { is_expected.to be_running }
end

describe process('puma: cluster worker') do
its(:count) { is_expected.to eq 1 }
end
end
end
4 changes: 2 additions & 2 deletions spec/classes/foreman_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_service('foreman.socket').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('foreman').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('foreman').with_ensure('running').with_enable(true).that_comes_before('Service[foreman.socket]') }
end

context 'with apache' do
Expand All @@ -34,7 +34,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('foreman::service').that_requires('Class[apache::service]') }
it { is_expected.to contain_service('foreman.socket').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('foreman').with_ensure('running').with_enable(true) }
it { is_expected.to contain_service('foreman').with_ensure('running').with_enable(true).that_comes_before('Service[foreman.socket]') }

context 'without ssl' do
let(:params) { super().merge(ssl: false) }
Expand Down