Skip to content

Commit

Permalink
add specs for manage_service parameter, refs #158
Browse files Browse the repository at this point in the history
  • Loading branch information
luxflux committed May 19, 2015
1 parent 87b1305 commit b2de3b1
Showing 1 changed file with 65 additions and 34 deletions.
99 changes: 65 additions & 34 deletions spec/defines/openvpn_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -445,46 +445,77 @@
end

context 'systemd enabled RedHat' do
let(:facts) { {
:concat_basedir => '/var/lib/puppet/concat',
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
} }
let(:pre_condition) { "class { 'openvpn': manage_service => #{manage_service} }" }
let(:facts) do
{
:concat_basedir => '/var/lib/puppet/concat',
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
}
end
let(:params) do
{
'country' => 'CO',
'province' => 'ST',
'city' => 'Some City',
'organization' => 'example.org',
'email' => 'testemail@example.org'
}
end

let(:params) { {
'country' => 'CO',
'province' => 'ST',
'city' => 'Some City',
'organization' => 'example.org',
'email' => 'testemail@example.org'
} }

it { should contain_service('openvpn@test_server').with(
:ensure => 'running',
:enable => true,
)}
context 'service is managed' do
let(:manage_service) { true }
it { should contain_service('openvpn@test_server').with(
:ensure => 'running',
:enable => true,
)}
end

context 'service is unmanaged' do
let(:manage_service) { false }
it { should_not contain_service('openvpn@test_server').with(
:ensure => 'running',
:enable => true,
)}
end
end

context 'systemd enabled Debian' do
let(:facts) { {
:concat_basedir => '/var/lib/puppet/concat',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '8.0',
} }
let(:pre_condition) { "class { 'openvpn': manage_service => #{manage_service} }" }
let(:facts) do
{
:concat_basedir => '/var/lib/puppet/concat',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '8.0',
}
end

let(:params) { {
'country' => 'CO',
'province' => 'ST',
'city' => 'Some City',
'organization' => 'example.org',
'email' => 'testemail@example.org'
} }
let(:params) do
{
'country' => 'CO',
'province' => 'ST',
'city' => 'Some City',
'organization' => 'example.org',
'email' => 'testemail@example.org'
}
end

it { should contain_service('openvpn@test_server').with(
:ensure => 'running',
:enable => true,
)}
end
context 'service is managed' do
let(:manage_service) { true }
it { should contain_service('openvpn@test_server').with(
:ensure => 'running',
:enable => true,
)}
end

context 'service is unmanaged' do
let(:manage_service) { false }
it { should_not contain_service('openvpn@test_server').with(
:ensure => 'running',
:enable => true,
)}
end
end
end

0 comments on commit b2de3b1

Please sign in to comment.