-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #281 Background daemons of modules are not optional, so should no…
…t be treated like that in Puppet module
- Loading branch information
Showing
10 changed files
with
256 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'spec_helper' | ||
|
||
describe('icingaweb2::module::reporting::service', type: :class) do | ||
let(:pre_condition) do | ||
[ | ||
"class { 'icingaweb2': db_type => 'mysql' }", | ||
"class { 'icingaweb2::module::reporting': db_type => 'mysql', manage_service => false }", | ||
] | ||
end | ||
|
||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let :facts do | ||
facts | ||
end | ||
|
||
context "#{os} with defaults" do | ||
it do | ||
is_expected.to contain_user('icingareporting') | ||
.with( | ||
'ensure' => 'present', | ||
'gid' => 'icingaweb2', | ||
'shell' => '/bin/false', | ||
).that_comes_before('Systemd::Unit_file[icinga-reporting.service]') | ||
end | ||
it do | ||
is_expected.to contain_systemd__unit_file('icinga-reporting.service').with( | ||
content: %r{[Unit]}, | ||
).that_notifies('Service[icinga-reporting]') | ||
end | ||
it do | ||
is_expected.to contain_service('icinga-reporting') | ||
.with( | ||
'ensure' => 'running', | ||
'enable' => true, | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
require 'spec_helper' | ||
|
||
describe('icingaweb2::module::reporting', 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 db_type 'mysql'" do | ||
let(:params) do | ||
{ git_revision: 'foobar', | ||
db_type: 'mysql' } | ||
end | ||
|
||
it { | ||
is_expected.to contain_icingaweb2__resource__database('reporting') | ||
.with_type('mysql') | ||
.with_host('localhost') | ||
.with_database('reporting') | ||
.with_username('reporting') | ||
.with_charset('utf8mb4') | ||
} | ||
|
||
it { | ||
is_expected.to contain_icingaweb2__module('reporting') | ||
.with_install_method('git') | ||
.with_git_revision('foobar') | ||
.with_module_dir('/usr/share/icingaweb2/modules/reporting') | ||
.with_settings('icingaweb2-module-reporting-backend' => { | ||
'section_name' => 'backend', | ||
'target' => '/etc/icingaweb2/modules/reporting/config.ini', | ||
'settings' => { | ||
'resource' => 'reporting', | ||
}, | ||
}, | ||
'icingaweb2-module-reporting-mail' => { | ||
'section_name' => 'mail', | ||
'target' => '/etc/icingaweb2/modules/reporting/config.ini', | ||
'settings' => {}, | ||
}) | ||
} | ||
|
||
it { is_expected.not_to contain_exec('import icingaweb2::module::reporting schema') } | ||
|
||
it { | ||
is_expected.to contain_class('icingaweb2::module::reporting::service') | ||
.with_ensure('running') | ||
.with_enable(true) | ||
} | ||
end | ||
|
||
context "#{os} with db_type 'mysql', import_schema 'true'" do | ||
let(:params) do | ||
{ db_type: 'mysql', | ||
import_schema: true } | ||
end | ||
|
||
it { is_expected.to contain_exec('import icingaweb2::module::reporting schema') } | ||
end | ||
|
||
context "#{os} with db_type 'pgsql', mail '[email protected]', manage_service 'false', install_method 'package'" do | ||
let(:params) do | ||
{ install_method: 'package', | ||
db_type: 'pgsql', | ||
manage_service: false, | ||
mail: '[email protected]' } | ||
end | ||
|
||
it { | ||
is_expected.to contain_icingaweb2__resource__database('reporting') | ||
.with_type('pgsql') | ||
.with_host('localhost') | ||
.with_database('reporting') | ||
.with_username('reporting') | ||
.with_charset('UTF8') | ||
} | ||
|
||
it { | ||
is_expected.to contain_icingaweb2__module('reporting') | ||
.with_install_method('package') | ||
.with_package_name('icingaweb2-module-reporting') | ||
.with_module_dir('/usr/share/icingaweb2/modules/reporting') | ||
.with_settings('icingaweb2-module-reporting-backend' => { | ||
'section_name' => 'backend', | ||
'target' => '/etc/icingaweb2/modules/reporting/config.ini', | ||
'settings' => { | ||
'resource' => 'reporting', | ||
}, | ||
}, | ||
'icingaweb2-module-reporting-mail' => { | ||
'section_name' => 'mail', | ||
'target' => '/etc/icingaweb2/modules/reporting/config.ini', | ||
'settings' => { | ||
'from' => '[email protected]', | ||
}, | ||
}) | ||
} | ||
|
||
it { is_expected.not_to contain_exec('import icingaweb2::module::reporting schema') } | ||
it { is_expected.not_to contain_class('icingaweb2::module::reporting::service') } | ||
end | ||
|
||
context "#{os} with db_type 'pgsql', import_schema 'true'" do | ||
let(:params) do | ||
{ db_type: 'pgsql', | ||
import_schema: true } | ||
end | ||
|
||
it { is_expected.to contain_exec('import icingaweb2::module::reporting schema') } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.