|
0 |
require 'spec_helper_acceptance'
|
|
1 |
|
|
2 |
describe 'basic gnocchi_config resource' do
|
|
3 |
|
|
4 |
context 'default parameters' do
|
|
5 |
|
|
6 |
it 'should work with no errors' do
|
|
7 |
pp= <<-EOS
|
|
8 |
Exec { logoutput => 'on_failure' }
|
|
9 |
|
|
10 |
File <||> -> Gnocchi_config <||>
|
|
11 |
File <||> -> Gnocchi_api_paste_ini <||>
|
|
12 |
|
|
13 |
file { '/etc/gnocchi' :
|
|
14 |
ensure => directory,
|
|
15 |
}
|
|
16 |
file { '/etc/gnocchi/gnocchi.conf' :
|
|
17 |
ensure => file,
|
|
18 |
}
|
|
19 |
file { '/etc/gnocchi/api-paste.ini' :
|
|
20 |
ensure => file,
|
|
21 |
}
|
|
22 |
|
|
23 |
gnocchi_config { 'DEFAULT/thisshouldexist' :
|
|
24 |
value => 'foo',
|
|
25 |
}
|
|
26 |
|
|
27 |
gnocchi_config { 'DEFAULT/thisshouldnotexist' :
|
|
28 |
value => '<SERVICE DEFAULT>',
|
|
29 |
}
|
|
30 |
|
|
31 |
gnocchi_config { 'DEFAULT/thisshouldexist2' :
|
|
32 |
value => '<SERVICE DEFAULT>',
|
|
33 |
ensure_absent_val => 'toto',
|
|
34 |
}
|
|
35 |
|
|
36 |
gnocchi_config { 'DEFAULT/thisshouldexist3' :
|
|
37 |
value => ['foo', 'bar'],
|
|
38 |
}
|
|
39 |
|
|
40 |
gnocchi_config { 'DEFAULT/thisshouldnotexist2' :
|
|
41 |
value => 'toto',
|
|
42 |
ensure_absent_val => 'toto',
|
|
43 |
}
|
|
44 |
|
|
45 |
gnocchi_api_paste_ini { 'DEFAULT/thisshouldexist' :
|
|
46 |
value => 'foo',
|
|
47 |
}
|
|
48 |
|
|
49 |
gnocchi_api_paste_ini { 'DEFAULT/thisshouldnotexist' :
|
|
50 |
value => '<SERVICE DEFAULT>',
|
|
51 |
}
|
|
52 |
|
|
53 |
gnocchi_api_paste_ini { 'DEFAULT/thisshouldexist2' :
|
|
54 |
value => '<SERVICE DEFAULT>',
|
|
55 |
ensure_absent_val => 'toto',
|
|
56 |
}
|
|
57 |
|
|
58 |
gnocchi_api_paste_ini { 'DEFAULT/thisshouldnotexist2' :
|
|
59 |
value => 'toto',
|
|
60 |
ensure_absent_val => 'toto',
|
|
61 |
}
|
|
62 |
|
|
63 |
gnocchi_api_paste_ini { 'DEFAULT/thisshouldexist3' :
|
|
64 |
value => 'foo',
|
|
65 |
key_val_separator => ':'
|
|
66 |
}
|
|
67 |
EOS
|
|
68 |
|
|
69 |
|
|
70 |
# Run it twice and test for idempotency
|
|
71 |
apply_manifest(pp, :catch_failures => true)
|
|
72 |
apply_manifest(pp, :catch_changes => true)
|
|
73 |
end
|
|
74 |
|
|
75 |
describe file('/etc/gnocchi/gnocchi.conf') do
|
|
76 |
it { is_expected.to exist }
|
|
77 |
it { is_expected.to contain('thisshouldexist=foo') }
|
|
78 |
it { is_expected.to contain('thisshouldexist2=<SERVICE DEFAULT>') }
|
|
79 |
it { is_expected.to contain('thisshouldexist3=foo') }
|
|
80 |
it { is_expected.to contain('thisshouldexist3=bar') }
|
|
81 |
|
|
82 |
describe '#content' do
|
|
83 |
subject { super().content }
|
|
84 |
it { is_expected.to_not match /thisshouldnotexist/ }
|
|
85 |
end
|
|
86 |
end
|
|
87 |
|
|
88 |
describe file('/etc/gnocchi/api-paste.ini') do
|
|
89 |
it { is_expected.to exist }
|
|
90 |
it { is_expected.to contain('thisshouldexist=foo') }
|
|
91 |
it { is_expected.to contain('thisshouldexist2=<SERVICE DEFAULT>') }
|
|
92 |
it { is_expected.to contain('thisshouldexist3:foo') }
|
|
93 |
|
|
94 |
describe '#content' do
|
|
95 |
subject { super().content }
|
|
96 |
it { is_expected.to_not match /thisshouldnotexist/ }
|
|
97 |
end
|
|
98 |
end
|
|
99 |
end
|
|
100 |
end
|