Skip to content

Commit

Permalink
Add IDO MySQL integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bobapple authored and n00by committed Apr 26, 2018
1 parent 8899d90 commit 1c0f23e
Show file tree
Hide file tree
Showing 13 changed files with 277 additions and 119 deletions.
1 change: 1 addition & 0 deletions serverspec/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
puppet.environment = "production"
puppet.environment_path = "environments"
puppet.hiera_config_path = "hiera.yaml"
#puppet.options = "--debug"
end

end
Expand Down
1 change: 1 addition & 0 deletions serverspec/environments/production/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod 'puppetlabs/concat', :latest
mod 'puppetlabs/apt', :latest
mod 'puppetlabs/chocolatey', :latest
mod 'puppetlabs/powershell', :latest
mod 'puppetlabs/mysql', :latest
mod 'badgerious/windows_env', :latest
mod 'darin/zypprepo', :latest
mod 'icinga2',
Expand Down
54 changes: 35 additions & 19 deletions serverspec/environments/production/manifests/default.pp
Original file line number Diff line number Diff line change
@@ -1,37 +1,53 @@
node /(debian|rhel|ubuntu|sles|oracle)/ {
class { '::icinga2':
manage_repo => true,
}
node default {
package { 'curl': }

class { '::icinga2::pki::ca': }
case $::kernel {
'linux': {
$manage_repo = true
$target_dir = '/etc/icinga2/conf.d'
} # linux

'windows': {
$manage_repo = false
$target_dir = 'C:/ProgramData/icinga2/etc/icinga2/conf.d'
} # windows

'FreeBSD': {
$manage_repo = false
$target_dir = '/usr/local/etc/icinga2/conf.d'
} # FreeBSD
}

class { '::icinga2::feature::api':
pki => 'none',
class { '::icinga2':
manage_repo => $manage_repo,
}

icinga2::object::apiuser { 'icinga':
target => '/etc/icinga2/conf.d/apiuser.conf',
target => "${target_dir}/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 => [ "*" ],
include ::mysql::server

mysql::db { 'icinga2':
user => 'icinga2',
password => 'supersecret',
host => 'localhost',
grant => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE VIEW', 'CREATE', 'INDEX', 'EXECUTE', 'ALTER'],
}

package { 'curl': }
-> class{ '::icinga2::feature::idomysql':
user => 'icinga2',
password => 'supersecret',
database => 'icinga2',
import_schema => true,
require => Mysql::Db['icinga2'],
}
}
34 changes: 24 additions & 10 deletions serverspec/spec/i2debian7puppet4/plattform_independent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'spec_helper'

describe package('icinga2') do
it { should be_installed }
end
describe 'Basic Icinga 2 Installation' do
context package('icinga2') do
it { should be_installed }
end

describe service('icinga2') do
it { should be_enabled }
it { should be_running }
context service('icinga2') do
it { should be_enabled }
it { should be_running }
end
end

describe port(5665) do
it { should be_listening.with('tcp') }
describe 'API Feature' do
context port(5665) do
it { should be_listening.with('tcp') }
end

context command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
end
end

describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
describe 'MySQL IDO Feature' do
context port(3306) do
it { should be_listening.with('tcp') }
end

context command('mysql -e "select version from icinga_dbversion" icinga2') do
its(:stdout) { should match(%r{version}) }
end
end
34 changes: 24 additions & 10 deletions serverspec/spec/i2debian8puppet4/plattform_independent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'spec_helper'

describe package('icinga2') do
it { should be_installed }
end
describe 'Basic Icinga 2 Installation' do
context package('icinga2') do
it { should be_installed }
end

describe service('icinga2') do
it { should be_enabled }
it { should be_running }
context service('icinga2') do
it { should be_enabled }
it { should be_running }
end
end

describe port(5665) do
it { should be_listening.with('tcp') }
describe 'API Feature' do
context port(5665) do
it { should be_listening.with('tcp') }
end

context command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
end
end

describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
describe 'MySQL IDO Feature' do
context port(3306) do
it { should be_listening.with('tcp') }
end

context command('mysql -e "select version from icinga_dbversion" icinga2') do
its(:stdout) { should match(%r{version}) }
end
end
34 changes: 24 additions & 10 deletions serverspec/spec/i2freebsd10puppet4/plattform_independent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'spec_helper'

describe package('icinga2') do
it { should be_installed }
end
describe 'Basic Icinga 2 Installation' do
context package('icinga2') do
it { should be_installed }
end

describe service('icinga2') do
it { should be_enabled }
it { should be_running }
context service('icinga2') do
it { should be_enabled }
it { should be_running }
end
end

describe port(5665) do
it { should be_listening.with('tcp') }
describe 'API Feature' do
context port(5665) do
it { should be_listening.with('tcp') }
end

context command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
end
end

describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
describe 'MySQL IDO Feature' do
context port(3306) do
it { should be_listening.with('tcp') }
end

context command('mysql -e "select version from icinga_dbversion" icinga2') do
its(:stdout) { should match(%r{version}) }
end
end
34 changes: 24 additions & 10 deletions serverspec/spec/i2freebsd11puppet4/plattform_independent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'spec_helper'

describe package('icinga2') do
it { should be_installed }
end
describe 'Basic Icinga 2 Installation' do
context package('icinga2') do
it { should be_installed }
end

describe service('icinga2') do
it { should be_enabled }
it { should be_running }
context service('icinga2') do
it { should be_enabled }
it { should be_running }
end
end

describe port(5665) do
it { should be_listening.with('tcp') }
describe 'API Feature' do
context port(5665) do
it { should be_listening.with('tcp') }
end

context command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
end
end

describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
describe 'MySQL IDO Feature' do
context port(3306) do
it { should be_listening.with('tcp') }
end

context command('mysql -e "select version from icinga_dbversion" icinga2') do
its(:stdout) { should match(%r{version}) }
end
end
34 changes: 24 additions & 10 deletions serverspec/spec/i2oracle7puppet4/plattform_independent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'spec_helper'

describe package('icinga2') do
it { should be_installed }
end
describe 'Basic Icinga 2 Installation' do
context package('icinga2') do
it { should be_installed }
end

describe service('icinga2') do
it { should be_enabled }
it { should be_running }
context service('icinga2') do
it { should be_enabled }
it { should be_running }
end
end

describe port(5665) do
it { should be_listening.with('tcp') }
describe 'API Feature' do
context port(5665) do
it { should be_listening.with('tcp') }
end

context command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
end
end

describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
describe 'MySQL IDO Feature' do
context port(3306) do
it { should be_listening.with('tcp') }
end

context command('mysql -e "select version from icinga_dbversion" icinga2') do
its(:stdout) { should match(%r{version}) }
end
end
34 changes: 24 additions & 10 deletions serverspec/spec/i2rhel6puppet4/plattform_independent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'spec_helper'

describe package('icinga2') do
it { should be_installed }
end
describe 'Basic Icinga 2 Installation' do
context package('icinga2') do
it { should be_installed }
end

describe service('icinga2') do
it { should be_enabled }
it { should be_running }
context service('icinga2') do
it { should be_enabled }
it { should be_running }
end
end

describe port(5665) do
it { should be_listening.with('tcp') }
describe 'API Feature' do
context port(5665) do
it { should be_listening.with('tcp') }
end

context command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
end
end

describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
describe 'MySQL IDO Feature' do
context port(3306) do
it { should be_listening.with('tcp') }
end

context command('mysql -e "select version from icinga_dbversion" icinga2') do
its(:stdout) { should match(%r{version}) }
end
end
34 changes: 24 additions & 10 deletions serverspec/spec/i2rhel7puppet4/plattform_independent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'spec_helper'

describe package('icinga2') do
it { should be_installed }
end
describe 'Basic Icinga 2 Installation' do
context package('icinga2') do
it { should be_installed }
end

describe service('icinga2') do
it { should be_enabled }
it { should be_running }
context service('icinga2') do
it { should be_enabled }
it { should be_running }
end
end

describe port(5665) do
it { should be_listening.with('tcp') }
describe 'API Feature' do
context port(5665) do
it { should be_listening.with('tcp') }
end

context command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
end
end

describe command('curl -u icinga:icinga -k https://localhost:5665/v1') do
its(:stdout) { should match(%r{Hello from Icinga 2}) }
describe 'MySQL IDO Feature' do
context port(3306) do
it { should be_listening.with('tcp') }
end

context command('mysql -e "select version from icinga_dbversion" icinga2') do
its(:stdout) { should match(%r{version}) }
end
end
Loading

0 comments on commit 1c0f23e

Please sign in to comment.