/
director_spec.rb
110 lines (100 loc) · 3.77 KB
/
director_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
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
require 'spec_helper'
describe('icingaweb2::module::director', type: :class) do
let(:pre_condition) do
[
"class { 'icingaweb2': db_type => 'mysql' }",
]
end
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
context "#{os} with kickstart 'true'" do
let(:params) do
{ git_revision: 'foobar',
db_type: 'mysql',
db_host: 'localhost',
db_name: 'director',
db_username: 'director',
db_password: 'director',
import_schema: true,
kickstart: true,
endpoint: 'foobar',
api_username: 'root',
api_password: 'secret' }
end
it {
is_expected.to contain_icingaweb2__resource__database('icingaweb2-module-director')
.with_type('mysql')
.with_host('localhost')
.with_database('director')
.with_username('director')
.with_password('director')
.with_charset('utf8')
}
it {
is_expected.to contain_icingaweb2__module('director')
.with_install_method('git')
.with_git_revision('foobar')
.with_module_dir('/usr/share/icingaweb2/modules/director')
.with_settings('module-director-db' => {
'section_name' => 'db',
'target' => '/etc/icingaweb2/modules/director/config.ini',
'settings' => {
'resource' => 'icingaweb2-module-director',
},
},
'module-director-config' => {
'section_name' => 'config',
'target' => '/etc/icingaweb2/modules/director/kickstart.ini',
'settings' => {
'endpoint' => 'foobar',
'host' => 'localhost',
'port' => '5665',
'username' => 'root',
'password' => 'secret',
},
})
}
it { is_expected.to contain_exec('director-migration') }
it { is_expected.to contain_exec('director-kickstart') }
end
context "#{os} with import_schema 'false'" do
let(:params) do
{ git_revision: 'foobar',
db_type: 'mysql',
db_host: 'localhost',
db_name: 'director',
db_username: 'director',
db_password: 'director',
import_schema: false }
end
it {
is_expected.to contain_icingaweb2__resource__database('icingaweb2-module-director')
.with_type('mysql')
.with_host('localhost')
.with_database('director')
.with_username('director')
.with_password('director')
.with_charset('utf8')
}
it {
is_expected.to contain_icingaweb2__module('director')
.with_install_method('git')
.with_git_revision('foobar')
.with_module_dir('/usr/share/icingaweb2/modules/director')
.with_settings('module-director-db' => {
'section_name' => 'db',
'target' => '/etc/icingaweb2/modules/director/config.ini',
'settings' => {
'resource' => 'icingaweb2-module-director',
},
})
}
it { is_expected.not_to contain_exec('director-migration') }
it { is_expected.not_to contain_exec('director-kickstart') }
end
end
end
end