Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dwerder committed Apr 17, 2016
1 parent 25cc096 commit 1f49faf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# optional: python-ldap, python-memcache, memcached, python-sqlite

if ($::osfamily == 'RedHat' and $::operatingsystemrelease =~ /^7\.\d+/) or (
$::osfamily == 'Debian' and $::operatingsystemmajrelease =~ /8|15\.10/) {
$::graphite::params::service_provider == 'debian' and $::operatingsystemmajrelease =~ /8|15\.10/) {
$initscript_notify = [Exec['graphite-reload-systemd'],]

exec { 'graphite-reload-systemd':
Expand Down
2 changes: 0 additions & 2 deletions manifests/config_apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@
hasstatus => true;
}



# Deploy configfiles
file {
"${::graphite::params::apache_dir}/ports.conf":
Expand Down
16 changes: 16 additions & 0 deletions spec/classes/graphite_config_apache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,26 @@

shared_context 'RedHat supported platforms' do
it { is_expected.to contain_package('httpd').only_with({ :name => 'httpd', :ensure => 'installed' }) }
it { is_expected.to contain_package('mod_wsgi').only_with({ :name => 'mod_wsgi', :ensure => 'installed', 'require' => 'Package[httpd]'}) }
it { is_expected.to contain_service('httpd').only_with({
:name => 'httpd',
:ensure => 'running',
:enable => 'true',
:hasrestart => 'true',
:hasstatus => 'true'})
}
end

shared_context 'Debian supported platforms' do
it { is_expected.to contain_package('apache2').only_with({ :name => 'apache2', :ensure => 'installed' }) }
it { is_expected.to contain_package('libapache2-mod-wsgi').only_with({ :name => 'libapache2-mod-wsgi', :ensure => 'installed', 'require' => 'Package[apache2]'}) }
it { is_expected.to contain_service('apache2').only_with({
:name => 'apache2',
:ensure => 'running',
:enable => 'true',
:hasrestart => 'true',
:hasstatus => 'true'})
}
end

context 'Unsupported OS' do
Expand Down
1 change: 1 addition & 0 deletions spec/classes/graphite_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
it { is_expected.to contain_package('pyOpenSSL').with_provider(nil) }
it { is_expected.to contain_package('python-memcached').with_provider(nil) }
it { is_expected.to contain_package('python-zope-interface').with_provider(nil) }
it { is_expected.to contain_package('python-tzlocal').with_provider(nil) }
end

shared_context 'RedHat 6 platforms' do
Expand Down
5 changes: 3 additions & 2 deletions spec/classes/graphite_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
let(:facts) do
facts
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('graphite::params') }
it { is_expected.to contain_anchor('graphite::begin').that_comes_before('Class[graphite::install]') }
it { is_expected.to contain_class('graphite::install').that_notifies('Class[graphite::config]') }
it { is_expected.to contain_class('graphite::config').that_comes_before('Anchor[graphite::end]') }
it { is_expected.to contain_anchor('graphite::end') }
it { is_expected.to contain_anchor('graphite::end') }

end
end
Expand Down

0 comments on commit 1f49faf

Please sign in to comment.