From 57da0f7658def1b76557cb69037da51631ad31c1 Mon Sep 17 00:00:00 2001 From: Blerim Sheqa Date: Fri, 7 Apr 2017 11:04:54 +0200 Subject: [PATCH] Add API integration tests fixes #206 --- serverspec/environments/production/Puppetfile | 2 +- .../production/manifests/default.pp | 32 +++++++++++++++++-- .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ .../plattform_independent_spec.rb | 8 +++++ 12 files changed, 111 insertions(+), 3 deletions(-) diff --git a/serverspec/environments/production/Puppetfile b/serverspec/environments/production/Puppetfile index d3b0ed96d..384337c3c 100644 --- a/serverspec/environments/production/Puppetfile +++ b/serverspec/environments/production/Puppetfile @@ -2,7 +2,7 @@ forge "http://forge.puppetlabs.com" mod 'puppetlabs/stdlib', :latest mod 'puppetlabs/concat', :latest -mod 'puppetlabs/apt', '1.8.0' +mod 'puppetlabs/apt', :latest mod 'puppetlabs/chocolatey', :latest mod 'puppetlabs/powershell', :latest mod 'badgerious/windows_env', :latest diff --git a/serverspec/environments/production/manifests/default.pp b/serverspec/environments/production/manifests/default.pp index 79d86c321..19e34cdae 100644 --- a/serverspec/environments/production/manifests/default.pp +++ b/serverspec/environments/production/manifests/default.pp @@ -1,9 +1,37 @@ -node /(debian|rhel|ubuntu|sles)/ { +node /(debian|rhel|ubuntu|sles|oracle)/ { class { '::icinga2': - manage_repo => true, + manage_repo => true, } + + class { '::icinga2::pki::ca': } + + class { '::icinga2::feature::api': + pki => 'none', + } + + icinga2::object::apiuser { 'icinga': + target => '/etc/icinga2/conf.d/apiuser.conf', + password => 'icinga', + permissions => [ "*" ], + } + + package { 'curl': } } node /freebsd/ { class { '::icinga2': } + + class { '::icinga2::pki::ca': } + + class { '::icinga2::feature::api': + pki => 'none', + } + + icinga2::object::apiuser { 'icinga': + target => '/usr/local/etc/icinga2/conf.d/apiuser.conf', + password => 'icinga', + permissions => [ "*" ], + } + + package { 'curl': } } diff --git a/serverspec/spec/i2debian7puppet4/plattform_independent_spec.rb b/serverspec/spec/i2debian7puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2debian7puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2debian7puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2debian8puppet4/plattform_independent_spec.rb b/serverspec/spec/i2debian8puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2debian8puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2debian8puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2freebsd10puppet4/plattform_independent_spec.rb b/serverspec/spec/i2freebsd10puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2freebsd10puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2freebsd10puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2freebsd11puppet4/plattform_independent_spec.rb b/serverspec/spec/i2freebsd11puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2freebsd11puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2freebsd11puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2oracle7puppet4/plattform_independent_spec.rb b/serverspec/spec/i2oracle7puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2oracle7puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2oracle7puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2rhel6puppet4/plattform_independent_spec.rb b/serverspec/spec/i2rhel6puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2rhel6puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2rhel6puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2rhel7puppet4/plattform_independent_spec.rb b/serverspec/spec/i2rhel7puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2rhel7puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2rhel7puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2sles12sp2puppet4/plattform_independent_spec.rb b/serverspec/spec/i2sles12sp2puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2sles12sp2puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2sles12sp2puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2ubuntu14puppet4/plattform_independent_spec.rb b/serverspec/spec/i2ubuntu14puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2ubuntu14puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2ubuntu14puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end diff --git a/serverspec/spec/i2ubuntu16puppet4/plattform_independent_spec.rb b/serverspec/spec/i2ubuntu16puppet4/plattform_independent_spec.rb index caa382dc1..9ba76d34a 100644 --- a/serverspec/spec/i2ubuntu16puppet4/plattform_independent_spec.rb +++ b/serverspec/spec/i2ubuntu16puppet4/plattform_independent_spec.rb @@ -8,3 +8,11 @@ it { should be_enabled } it { should be_running } end + +describe port(5665) do + it { should be_listening.with('tcp') } +end + +describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do + its(:stdout) { should match(%r{Hello from Icinga 2}) } +end