Skip to content
Permalink
Browse files

Remove obsolete explicit rspec tests for windows

Windows facts are included in facterdb meanwhile. There is no need
for explicit testing.
  • Loading branch information...
bobapple committed Apr 24, 2018
1 parent 29eb145 commit 80c5d657334bac1da6dc73aefc73349c7fa4411e
Showing with 58 additions and 6,059 deletions.
  1. +2 −0 .rspec
  2. +1 −0 .rspec_parallel
  3. +7 −17 Gemfile
  4. +2 −2 manifests/feature/elasticsearch.pp
  5. +1 −281 spec/classes/api_spec.rb
  6. +1 −106 spec/classes/ca_spec.rb
  7. +1 −61 spec/classes/checker_spec.rb
  8. +1 −71 spec/classes/command_spec.rb
  9. +1 −89 spec/classes/compatlog_spec.rb
  10. +2 −161 spec/classes/config_spec.rb
  11. +1 −71 spec/classes/debuglog_spec.rb
  12. +1 −110 spec/classes/gelf_spec.rb
  13. +1 −153 spec/classes/graphite_spec.rb
  14. +1 −355 spec/classes/idomysql_spec.rb
  15. +1 −216 spec/classes/idopgsql_spec.rb
  16. +1 −339 spec/classes/influxdb_spec.rb
  17. +0 −91 spec/classes/init_spec.rb
  18. +1 −131 spec/classes/livestatus_spec.rb
  19. +1 −94 spec/classes/mainlog_spec.rb
  20. +1 −71 spec/classes/notification_spec.rb
  21. +1 −81 spec/classes/opentsdb_spec.rb
  22. +1 −158 spec/classes/perfdata_spec.rb
  23. +1 −63 spec/classes/service_spec.rb
  24. +1 −108 spec/classes/statusdata_spec.rb
  25. +1 −72 spec/classes/syslog_spec.rb
  26. +1 −80 spec/defines/apiuser_spec.rb
  27. +1 −93 spec/defines/checkcommand_spec.rb
  28. +1 −69 spec/defines/checkresultreader_spec.rb
  29. +1 −84 spec/defines/compatlogger_spec.rb
  30. +1 −212 spec/defines/dependency_spec.rb
  31. +1 −97 spec/defines/endpoint_spec.rb
  32. +1 −130 spec/defines/eventcommand_spec.rb
  33. +1 −62 spec/defines/feature_spec.rb
  34. +1 −35 spec/defines/fragment_spec.rb
  35. +1 −464 spec/defines/host_spec.rb
  36. +1 −72 spec/defines/hostgroup_spec.rb
  37. +1 −205 spec/defines/notification_spec.rb
  38. +1 −129 spec/defines/notificationcommand_spec.rb
  39. +1 −280 spec/defines/object_spec.rb
  40. +1 −174 spec/defines/scheduleddowntime_spec.rb
  41. +1 −437 spec/defines/service_spec.rb
  42. +1 −75 spec/defines/servicegroup_spec.rb
  43. +1 −123 spec/defines/timeperiod_spec.rb
  44. +1 −160 spec/defines/user_spec.rb
  45. +1 −81 spec/defines/usergroup_spec.rb
  46. +1 −96 spec/defines/zone_spec.rb
  47. +4 −0 spec/spec_helper.rb
2 .rspec
@@ -0,0 +1,2 @@
--format documentation
--color
@@ -0,0 +1 @@
--format progress
24 Gemfile
@@ -1,23 +1,13 @@
source 'https://rubygems.org'

gem 'puppet', ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'].to_s : '>= 3.8'
gem 'puppet', ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'].to_s : '>= 4.9'

gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'
gem 'facterdb', '>= 0.3.12'
gem 'puppetlabs_spec_helper', '>= 2.0'
gem 'puppet-lint', '>= 2.0.0'
gem 'facter', '>= 2.4.0'
gem 'facterdb', '>= 0.5'
gem 'rspec-puppet-facts', '>= 1.6.0'
gem 'serverspec'
gem 'r10k'

gem 'parallel_tests', RUBY_VERSION < '2.0.0' ? '~> 2.9.0' : '>= 2.10.0'

# json > 2.0.1 is not compatible with Ruby 1.9
# metadata-json-lint > 1.1.0 is not compatible with Ruby 1.9
if RUBY_VERSION < '2.0.0'
gem 'json', '< 2'
gem 'json_pure', '< 2'
gem 'metadata-json-lint', '< 1.2.0'
else
gem 'metadata-json-lint'
end
gem 'parallel_tests', '>= 2.10.0'
gem 'metadata-json-lint'
@@ -187,7 +187,7 @@

if $ssl_cert {
$_ssl_cert = $::osfamily ? {
'windows' => regsubst($cert_path, '\n', "\r\n", 'EMG'),
'windows' => regsubst($ssl_cert, '\n', "\r\n", 'EMG'),
default => $ssl_cert,
}

@@ -200,7 +200,7 @@

if $ssl_cacert {
$_ssl_cacert = $::osfamily ? {
'windows' => regsubst($ca_path, '\n', "\r\n", 'EMG'),
'windows' => regsubst($ssl_cacert, '\n', "\r\n", 'EMG'),
default => $ssl_cacert,
}

@@ -300,284 +300,4 @@
end
end
end
end


describe('icinga2::feature::api', :type => :class) do
let(:facts) { {
:kernel => 'Windows',
:architecture => 'x86_64',
:osfamily => 'Windows',
:operatingsystem => 'Windows',
:operatingsystemmajrelease => '2012 R2',
:path => 'C:\Program Files\Puppet Labs\Puppet\puppet\bin;
C:\Program Files\Puppet Labs\Puppet\facter\bin;
C:\Program Files\Puppet Labs\Puppet\hiera\bin;
C:\Program Files\Puppet Labs\Puppet\mcollective\bin;
C:\Program Files\Puppet Labs\Puppet\bin;
C:\Program Files\Puppet Labs\Puppet\sys\ruby\bin;
C:\Program Files\Puppet Labs\Puppet\sys\tools\bin;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\ProgramData\chocolatey\bin;',
:icinga2_puppet_hostcert => 'C:\Program Files\Puppet Labs\Puppet\var\lib\puppet\ssl\certs\host.example.org.pem',
:icinga2_puppet_hostprivkey => 'C:\Program Files\Puppet Labs\Puppet\var\lib\puppet\ssl\private_keys\host.example.org.pem',
:icinga2_puppet_localcacert => 'C:\Program Files\Puppet Labs\Puppet\var\lib\puppet\ssl\certs\ca.pem',
} }
let(:pre_condition) { [
"class { 'icinga2': features => [], constants => {'NodeName' => 'host.example.org'} }"
] }


context 'Windows 2012 R2 with ensure => present' do
let(:params) { {:ensure => 'present'} }

it { is_expected.to contain_icinga2__feature('api').with({'ensure' => 'present'}) }

it { is_expected.to contain_icinga2__object('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.that_notifies('Class[icinga2::service]') }
end


context 'Windows 2012 R2 with ensure => absent' do
let(:params) { {:ensure => 'absent'} }

it { is_expected.to contain_icinga2__feature('api').with({'ensure' => 'absent'}) }

it { is_expected.to contain_icinga2__object('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' }) }
end


context "Windows 2012 R2 with all defaults" do
it { is_expected.to contain_icinga2__feature('api').with({'ensure' => 'present'}) }

it { is_expected.to contain_icinga2__object('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.that_notifies('Class[icinga2::service]') }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/accept_config = false/)
.with_content(/accept_commands = false/) }

it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/host.example.org.key') }
it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/host.example.org.crt') }
it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/ca.crt') }

it { is_expected.to contain_icinga2__object__endpoint('NodeName') }

it { is_expected.to contain_icinga2__object__zone('ZoneName')
.with({ 'endpoints' => [ 'NodeName' ] }) }
end


context "Windows 2012 R2 with pki => puppet" do
let(:params) { {:pki => 'puppet'} }

it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/host.example.org.key') }
it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/host.example.org.crt') }
it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/ca.crt') }
end


context "Windows 2012 R2 with pki => icinga2" do
let(:params) { {:pki => 'icinga2'} }

it { is_expected.to contain_exec('icinga2 pki create key') }
it { is_expected.to contain_exec('icinga2 pki get trusted-cert') }
it { is_expected.to contain_exec('icinga2 pki request') }
end


context "Windows 2012 R2 with pki => foo (not a valid value)" do
let(:params) { {:pki => 'foo'} }

it { is_expected.to raise_error(Puppet::Error, /expects a match for Enum\['ca', 'icinga2', 'none', 'puppet'\]/) }
end


context "Windows 2012 R2 with pki => none, ssl_key => foo, ssl_cert => bar, ssl_cacert => baz" do
let(:params) { {:pki => 'none', 'ssl_key' => 'foo', 'ssl_cert' => 'bar', 'ssl_cacert' => 'baz'} }

it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/host.example.org.key')
.with_content(/^foo/) }

it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/host.example.org.crt')
.with_content(/^bar/) }

it { is_expected.to contain_file('C:/ProgramData/icinga2/etc/icinga2/pki/ca.crt')
.with_content(/^baz/) }
end


context "Windows 2012 R2 with ssl_key_path = /foo/bar" do
let(:params) { {:ssl_key_path => '/foo/bar'} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/key_path = "\/foo\/bar"/) }
end


context "Windows 2012 R2 with ssl_key_path = foo/bar (not a valid absolute path)" do
let(:params) { {:ssl_key_path => 'foo/bar'} }

it { is_expected.to raise_error(Puppet::Error, /Evaluation Error: Error while evaluating a Resource Statement/) }
end


context "Windows 2012 R2 with ssl_cert_path = /foo/bar" do
let(:params) { {:ssl_cert_path => '/foo/bar'} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/cert_path = "\/foo\/bar"/) }
end


context "Windows 2012 R2 with ssl_cert_path = foo/bar (not a valid absolute path)" do
let(:params) { {:ssl_cert_path => 'foo/bar'} }

it { is_expected.to raise_error(Puppet::Error, /Evaluation Error: Error while evaluating a Resource Statement/) }
end


context "Windows 2012 R2 with ssl_cacert_path = /foo/bar" do
let(:params) { {:ssl_cacert_path => '/foo/bar'} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/ca_path = "\/foo\/bar"/) }
end


context "Windows 2012 R2 with ssl_cacert_path = foo/bar (not a valid absolute path)" do
let(:params) { {:ssl_cacert_path => 'foo/bar'} }

it { is_expected.to raise_error(Puppet::Error, /Evaluation Error: Error while evaluating a Resource Statement/) }
end


context "Windows 2012 R2 with accept_config => true" do
let(:params) { {:accept_config => true} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/accept_config = true/) }
end


context "Windows 2012 R2 with accept_config => false" do
let(:params) { {:accept_config => false} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/accept_config = false/) }
end


context "Windows 2012 R2 with accept_config => foo (not a valid boolean)" do
let(:params) { {:accept_config => 'foo'} }

it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) }
end


context "Windows 2012 R2 with accept_commands => true" do
let(:params) { {:accept_commands => true} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/accept_commands = true/) }
end


context "Windows 2012 R2 with accept_commands => false" do
let(:params) { {:accept_commands => false} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/accept_commands = false/) }
end


context "Windows 2012 R2 with accept_config => foo (not a valid boolean)" do
let(:params) { {:accept_commands => 'foo'} }

it { is_expected.to raise_error(Puppet::Error, /expects a Boolean value/) }
end


context "Windows 2012 R2 with pki => none, ticket_salt => foo" do
let(:params) { {:pki => 'none', :ticket_salt => 'foo'} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/ticket_salt = "foo"/) }
end


context "Windows 2012 R2 with pki => 'icinga2', ca_host => foo" do
let(:params) { {:pki => 'icinga2', :ca_host => 'foo'} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' }) }
end


context "Windows 2012 R2 with pki => 'icinga2', ca_port => 1234" do
let(:params) { {:pki => 'icinga2',:ca_port => 1234} }

it { is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' }) }
end


context "Windows 2012 R2 with pki => 'icinga2', ca_port => foo (not a valid integer)" do
let(:params) { {:pki => 'icinga2',:ca_port => 'foo'} }

it { is_expected.to raise_error(Puppet::Error, /expects an Integer value/) }
end


context "Windows 2012 R2 with endpoints => { foo => {} }" do
let(:params) { {:endpoints => { 'foo' => {}} }}

it { is_expected.to contain_icinga2__object__endpoint('foo') }
end


context "Windows 2012 R2 with endpoints => foo (not a valid hash)" do
let(:params) { {:endpoints => 'foo'} }

it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) }
end


context "Windows 2012 R2 with zones => { foo => {endpoints => ['bar']} } }" do
let(:params) { {:zones => { 'foo' => {'endpoints' => ['bar']}} }}

it { is_expected.to contain_icinga2__object__zone('foo')
.with({ 'endpoints' => [ 'bar' ] }) }
end


context "Windows 2012 R2 with zones => foo (not a valid hash)" do
let(:params) { {:zones => 'foo'} }

it { is_expected.to raise_error(Puppet::Error, /expects a Hash value/) }
end

context 'Windows 2012 R2 with bind settings' do
let(:params) { { bind_host: '::', bind_port: 1234 } }

it 'should set bind_* settings' do
is_expected.to contain_concat__fragment('icinga2::object::ApiListener::api')
.with({ 'target' => 'C:/ProgramData/icinga2/etc/icinga2/features-available/api.conf' })
.with_content(/bind_host = "::"/)
.with_content(/bind_port = 1234/)
end
end
end
end

0 comments on commit 80c5d65

Please sign in to comment.
You can’t perform that action at this time.