-
Notifications
You must be signed in to change notification settings - Fork 611
/
Copy pathclient_spec.rb
58 lines (48 loc) · 1.55 KB
/
client_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# frozen_string_literal: true
require 'spec_helper'
describe 'postgresql::client' do
include_examples 'Debian 11'
describe 'with parameters' do
let :params do
{
validcon_script_path: '/opt/bin/my-validate-con.sh',
package_ensure: 'absent',
package_name: 'mypackage',
file_ensure: 'file'
}
end
it 'modifies package' do
expect(subject).to contain_package('postgresql-client').with(ensure: 'absent',
name: 'mypackage',
tag: 'puppetlabs-postgresql')
end
it 'has specified validate connexion' do
expect(subject).to contain_file('/opt/bin/my-validate-con.sh').with(ensure: 'absent')
end
end
describe 'with no parameters' do
it 'creates package with postgresql tag' do
expect(subject).to contain_package('postgresql-client').with(tag: 'puppetlabs-postgresql')
end
end
describe 'with manage_dnf_module true' do
let(:pre_condition) do
<<-PUPPET
class { 'postgresql::globals':
manage_dnf_module => true,
}
PUPPET
end
it { is_expected.to contain_package('postgresql dnf module').that_comes_before('Package[postgresql-client]') }
end
describe 'with client package name explicitly set undef' do
let :params do
{
package_name: 'UNSET'
}
end
it 'does not manage postgresql-client package' do
expect(subject).not_to contain_package('postgresql-client')
end
end
end