-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathconfig_spec.rb
More file actions
124 lines (104 loc) · 3.97 KB
/
Copy pathconfig_spec.rb
File metadata and controls
124 lines (104 loc) · 3.97 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
require 'spec_helper'
describe 'openvoxdb::master::config', type: :class do
let(:node) { 'puppetdb.example.com' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
let(:termini_package_name) do
case facts[:os]['family']
when 'Archlinux', 'OpenBSD'
'puppetdb-termini'
when 'Debian', 'RedHat', 'Suse', 'Gentoo'
'openvoxdb-termini'
end
end
context 'when PuppetDB on remote server' do
context 'when using default values' do
it { is_expected.to compile.with_all_deps }
end
end
context 'when PuppetDB and Puppet Master are on the same server' do
context 'when using default values' do
let(:pre_condition) { 'class { "openvoxdb": }' }
it {
is_expected.to contain_puppetdb_conn_validator('puppetdb_conn').with(
puppetdb_server: 'puppetdb.example.com',
puppetdb_port: '8081',
use_ssl: 'true',
)
}
end
context 'when puppetdb class is declared with disable_ssl => true' do
let(:pre_condition) { 'class { "openvoxdb": disable_ssl => true }' }
it {
is_expected.to contain_puppetdb_conn_validator('puppetdb_conn').with(
puppetdb_port: '8080',
use_ssl: 'false',
)
}
end
context 'when puppetdb_port => 1234' do
let(:pre_condition) { 'class { "openvoxdb": }' }
let(:params) { { puppetdb_port: '1234' } }
it {
is_expected.to contain_puppetdb_conn_validator('puppetdb_conn').with(
puppetdb_port: '1234',
use_ssl: 'true',
)
}
end
context 'when puppetdb_port => 1234 AND the puppetdb class is declared with disable_ssl => true' do
let(:pre_condition) { 'class { "openvoxdb": disable_ssl => true }' }
let(:params) { { puppetdb_port: '1234' } }
it {
is_expected.to contain_puppetdb_conn_validator('puppetdb_conn').with(
puppetdb_port: '1234',
use_ssl: 'false',
)
}
end
context 'when using default values' do
it { is_expected.to contain_package(termini_package_name).with(ensure: 'present') }
it { is_expected.to contain_puppetdb_conn_validator('puppetdb_conn').with(test_url: '/pdb/meta/v1/version') }
end
end
context 'when restart_puppet is true' do
let(:pre_condition) { 'class { "openvoxdb": }' }
context 'with create_puppet_service_resource as default' do
let(:params) do
{
puppet_service_name: 'puppetserver',
restart_puppet: true,
}
end
it { is_expected.to contain_service('puppetserver').with(ensure: 'running') }
end
context 'with create_puppet_service_resource = true' do
let(:params) do
{
create_puppet_service_resource: true,
puppet_service_name: 'puppetserver',
restart_puppet: true,
}
end
it { is_expected.to contain_service('puppetserver').with(ensure: 'running') }
end
context 'with create_puppet_service_resource = false' do
# Also setting the various parameters that notify the service to be false. Otherwise this error surfaces:
# `Could not find resource 'Service[puppetserver]' for relationship from 'Class[Openvoxdb::Master::Puppetdb_conf]'`
let(:params) do
{
create_puppet_service_resource: false,
manage_config: false,
manage_report_processor: false,
manage_routes: false,
puppet_service_name: 'puppetserver',
restart_puppet: true,
}
end
it { is_expected.not_to contain_service('puppetserver') }
end
end
end
end
end