diff --git a/Gemfile b/Gemfile index 8007ad0..16052af 100644 --- a/Gemfile +++ b/Gemfile @@ -1,72 +1,86 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' def location_for(place_or_version, fake_version = nil) git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} file_url_regex = %r{\Afile:\/\/(?.*)} if place_or_version && (git_url = place_or_version.match(git_url_regex)) [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] else [place_or_version, { require: false }] end end ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') group :development do gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] end puppet_version = ENV['PUPPET_GEM_VERSION'] facter_version = ENV['FACTER_GEM_VERSION'] hiera_version = ENV['HIERA_GEM_VERSION'] gems = {} gems['puppet'] = location_for(puppet_version) # If facter or hiera versions have been specified via the environment # variables gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} # If we're using a Puppet gem on Windows which handles its own win32-xxx gem # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). gems['win32-dir'] = ['<= 0.4.9', require: false] gems['win32-eventlog'] = ['<= 0.6.5', require: false] gems['win32-process'] = ['<= 0.7.5', require: false] gems['win32-security'] = ['<= 0.2.5', require: false] gems['win32-service'] = ['0.8.8', require: false] end gems.each do |gem_name, gem_params| gem gem_name, *gem_params end # Evaluate Gemfile.local and ~/.gemfile if they exist extra_gemfiles = [ "#{__FILE__}.local", File.join(Dir.home, '.gemfile'), ] extra_gemfiles.each do |gemfile| if File.file?(gemfile) && File.readable?(gemfile) eval(File.read(gemfile), binding) end end + +#move to .sync.yaml in the future +gem 'puppetlabs_spec_helper', '>= 2.0' +gem 'puppet-lint', '>= 2.0.0' +gem 'facter', '>= 2.4.0' +gem 'facterdb', '>= 1.0.0' +gem 'rspec-puppet-facts', '>= 1.6.0' +gem 'serverspec' +gem 'r10k' +gem 'parallel_tests', '>= 2.10.0' +gem 'metadata-json-lint' +gem 'beaker-rspec' +gem 'beaker-vagrant' +gem 'beaker-puppet_install_helper' # vim: syntax=ruby diff --git a/spec/acceptance/apache2_spec.rb b/spec/acceptance/apache2_spec.rb deleted file mode 100644 index 319dc9d..0000000 --- a/spec/acceptance/apache2_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper_acceptance' - -describe 'icingaweb2 with apache2' do - it 'with basic settings and apache2' do - pp = " - class { 'apache': - mpm_module => 'prefork' - } - - class { 'apache::mod::php': } - - case $::osfamily { - 'redhat': { - file {'/etc/httpd/conf.d/icingaweb2.conf': - source => 'puppet:///modules/icingaweb2/examples/apache2/icingaweb2.conf', - require => Class['apache'], - notify => Service['httpd'], - } - - package { 'centos-release-scl': - before => Class['icingaweb2'] - } - } - 'debian': { - class { 'apache::mod::rewrite': } - - file {'/etc/apache2/conf.d/icingaweb2.conf': - source => 'puppet:///modules/icingaweb2/examples/apache2/icingaweb2.conf', - require => Class['apache'], - notify => Service['apache2'], - } - } - } - - class {'icingaweb2': - manage_repo => true, - } - " - - apply_manifest(pp, catch_failures: true) - end - - if fact('osfamily') == 'Debian' - describe service('apache2') do - it { is_expected.to be_running } - end - end - - if fact('osfamily') == 'RedHat' - describe service('httpd') do - it { is_expected.to be_running } - end - end - - describe command('curl -I http://localhost/icingaweb2/') do - its(:stdout) { should match(%r{302 Found}) } - end -end diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 004b28c..420972b 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -1,33 +1,177 @@ -#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' describe 'icingaweb2 class:' do - it 'runs successfully' do - pp = " - case $::osfamily { - 'redhat': { - package { 'centos-release-scl': - before => Class['icingaweb2'] + + describe 'icingaweb2 with defaults' do + let(:pp) do + <<-MANIFEST + case $::osfamily { + 'redhat': { + if $facts['os']['name'] == 'centos' and Integer($facts['os']['release']['major']) < 8 { + package { 'centos-release-scl': } + + $php_globals = { + php_version => 'rh-php71', + rhscl_mode => 'rhscl', + } + } else { + $php_globals = {} + } + + $php_extensions = { + mbstring => { ini_prefix => '20-' }, + json => { ini_prefix => '20-' }, + ldap => { ini_prefix => '20-' }, + gd => { ini_prefix => '20-' }, + xml => { ini_prefix => '20-' }, + intl => { ini_prefix => '20-' }, + mysqlnd => { ini_prefix => '20-' }, + pgsql => { ini_prefix => '20-' }, + } + $web_conf_user = 'apache' + } # RedHat + + 'debian': { + $php_globals = {} + $php_extensions = { + mbstring => {}, + json => {}, + ldap => {}, + gd => {}, + xml => {}, + intl => {}, + mysql => {}, + pgsql => {}, + } + $web_conf_user = 'www-data' + } # Debian + + default: { + fail("'Your operatingsystem ${::operatingsystem} is not supported.'") } } - } - class { '::icingaweb2': - manage_repo => true, - } - " + # + # PHP + # + class { '::php::globals': + * => $php_globals, + } + + class { '::php': + ensure => installed, + manage_repos => false, + apache_config => false, + fpm => true, + extensions => $php_extensions, + dev => false, + composer => false, + pear => false, + phpunit => false, + require => Class['::php::globals'], + } - apply_manifest(pp, catch_failures: true) - end + # + # Apache + # + class { '::apache': + default_mods => false, + default_vhost => false, + mpm_module => 'worker', + } - describe package('icingaweb2') do - it { is_expected.to be_installed } - end + apache::listen { '80': } + + include ::apache::mod::alias + include ::apache::mod::status + include ::apache::mod::dir + include ::apache::mod::env + include ::apache::mod::rewrite + include ::apache::mod::proxy + include ::apache::mod::proxy_fcgi + + apache::custom_config { 'icingaweb2': + ensure => present, + source => 'puppet:///modules/icingaweb2/examples/apache2/for-mod_proxy_fcgi.conf', + verify_config => false, + priority => false, + } + + # + # Icinga Web 2 + # + include ::mysql::server + + mysql::db { 'icingaweb2': + user => 'icingaweb2', + password => 'icingaweb2', + host => 'localhost', + grant => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE VIEW', 'CREATE', 'INDEX', 'EXECUTE', 'ALTER', 'REFERENCES'], + before => Class['icingaweb2'], + } + + Package['icingaweb2'] + -> Class['apache'] + + class { 'icingaweb2': + manage_repo => true, + conf_user => $web_conf_user, + db_type => 'mysql', + db_host => 'localhost', + db_port => 3306, + db_username => 'icingaweb2', + db_password => 'icingaweb2', + import_schema => true, + } + MANIFEST + end + + it_behaves_like 'a idempotent resource' + + describe package('icingaweb2') do + it { is_expected.to be_installed } + end + + describe file('/etc/icingaweb2/config.ini') do + it { is_expected.to be_file } + it { is_expected.to contain '[global]' } + it { is_expected.to contain '[logging]' } + end + + describe command('curl -I http://localhost/icingaweb2/') do + its(:stdout) { should match(%r{302 Found}) } + end + + describe file('/etc/icingaweb2/resources.ini') do + it { is_expected.to be_file } + it { is_expected.to contain '[mysql-icingaweb2]' } + it { is_expected.to contain 'type = "db"' } + it { is_expected.to contain 'db = "mysql"' } + it { is_expected.to contain 'host = "localhost"' } + it { is_expected.to contain 'port = "3306"' } + it { is_expected.to contain 'dbname = "icingaweb2"' } + it { is_expected.to contain 'username = "icingaweb2"' } + it { is_expected.to contain 'password = "icingaweb2"' } + end + + describe file('/etc/icingaweb2/authentication.ini') do + it { is_expected.to be_file } + it { is_expected.to contain '[mysql-auth]' } + it { is_expected.to contain 'backend = "db"' } + it { is_expected.to contain 'resource = "mysql-icingaweb2"' } + end + + describe file('/etc/icingaweb2/roles.ini') do + it { is_expected.to be_file } + it { is_expected.to contain '[default admin user]' } + it { is_expected.to contain 'users = "icingaadmin"' } + it { is_expected.to contain 'permissions = "*"' } + end + + describe command('mysql -e "select name from icingaweb2.icingaweb_user"') do + its(:stdout) { should match(%r{icingaadmin}) } + end - describe file('/etc/icingaweb2/config.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[global]' } - it { is_expected.to contain '[logging]' } end end diff --git a/spec/acceptance/icingaweb2_director_spec.rb b/spec/acceptance/icingaweb2_director_spec.rb deleted file mode 100644 index bfd04eb..0000000 --- a/spec/acceptance/icingaweb2_director_spec.rb +++ /dev/null @@ -1,103 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper_acceptance' - -describe 'icingaweb2::module::director class:' do - it 'runs successfully' do - pp = " - case $::osfamily { - 'redhat': { - package { 'centos-release-scl': - before => Class['icingaweb2'] - } - } - } - - package { 'git': } - - include ::mysql::server - - mysql::db { 'icingaweb2': - user => 'icingaweb2', - password => 'icingaweb2', - host => 'localhost', - grant => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE VIEW', 'CREATE', 'INDEX', 'EXECUTE', 'ALTER', 'REFERENCES'], - } - - mysql::db { 'director': - user => 'director', - password => 'director', - host => 'localhost', - charset => 'utf8', - grant => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE VIEW', 'CREATE', 'INDEX', 'EXECUTE', 'ALTER', 'REFERENCES'], - } - - class {'icingaweb2': - manage_repo => true, - import_schema => true, - db_type => 'mysql', - db_host => 'localhost', - db_port => 3306, - db_username => 'icingaweb2', - db_password => 'icingaweb2', - require => Mysql::Db['icingaweb2'], - } - - class {'icingaweb2::module::monitoring': - ido_host => 'localhost', - ido_db_name => 'icinga2', - ido_db_username => 'icinga2', - ido_db_password => 'supersecret', - commandtransports => { - icinga2 => { - transport => 'api', - username => 'root', - password => 'icinga', - } - } - } - - class {'icingaweb2::module::director': - git_revision => 'v1.3.2', - db_host => 'localhost', - db_name => 'director', - db_username => 'director', - db_password => 'director', - import_schema => true, - kickstart => false, - endpoint => 'puppet-icingaweb2.localdomain', - api_username => 'root', - api_password => 'icinga', - require => Mysql::Db['director'] - } - " - - apply_manifest(pp, catch_failures: true) - end - - describe file('/etc/icingaweb2/enabledModules/director') do - it { is_expected.to be_symlink } - end - - describe file('/etc/icingaweb2/modules/director/config.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[db]' } - it { is_expected.to contain 'resource = "icingaweb2-module-director"' } - end - - describe file('/etc/icingaweb2/resources.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[icingaweb2-module-director]' } - it { is_expected.to contain 'type = "db"' } - it { is_expected.to contain 'db = "mysql"' } - it { is_expected.to contain 'host = "localhost"' } - it { is_expected.to contain 'port = "3306"' } - it { is_expected.to contain 'dbname = "director"' } - it { is_expected.to contain 'username = "director"' } - it { is_expected.to contain 'password = "director"' } - it { is_expected.to contain 'charset = "utf8"' } - end - - #describe command('mysql -e "select object_name from director.icinga_apiuser"') do - # its(:stdout) { should match(%r{root}) } - #end -end diff --git a/spec/acceptance/icingaweb2_monitoring_spec.rb b/spec/acceptance/icingaweb2_monitoring_spec.rb deleted file mode 100644 index 3bab531..0000000 --- a/spec/acceptance/icingaweb2_monitoring_spec.rb +++ /dev/null @@ -1,118 +0,0 @@ -#! /usr/bin/env ruby -S rspec -require 'spec_helper_acceptance' - -describe 'icingaweb2::module::monitoring class:' do - it 'runs successfully' do - pp = " - case $::osfamily { - 'redhat': { - package { 'centos-release-scl': - before => Class['icingaweb2'] - } - } - } - - include ::mysql::server - - mysql::db { 'icingaweb2': - user => 'icingaweb2', - password => 'icingaweb2', - host => 'localhost', - grant => ['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'DROP', 'CREATE VIEW', 'CREATE', 'INDEX', 'EXECUTE', 'ALTER', 'REFERENCES'], - } - - class {'icingaweb2': - manage_repo => true, - import_schema => true, - db_type => 'mysql', - db_host => 'localhost', - db_port => 3306, - db_username => 'icingaweb2', - db_password => 'icingaweb2', - require => Mysql::Db['icingaweb2'], - } - - class {'icingaweb2::module::monitoring': - ido_host => 'localhost', - ido_db_name => 'icinga2', - ido_db_username => 'icinga2', - ido_db_password => 'supersecret', - commandtransports => { - icinga2 => { - transport => 'api', - username => 'root', - password => 'icinga', - } - } - } - " - - apply_manifest(pp, catch_failures: true) - end - - describe file('/etc/icingaweb2/enabledModules/monitoring') do - it { is_expected.to be_symlink } - end - - describe file('/etc/icingaweb2/modules/monitoring/config.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[security]' } - it { is_expected.to contain 'protected_customvars = "*pw*,*pass*,community"' } - end - - describe file('/etc/icingaweb2/modules/monitoring/backends.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[backends]' } - it { is_expected.to contain 'type = "ido"' } - it { is_expected.to contain 'resource = "icingaweb2-module-monitoring"' } - end - - describe file('/etc/icingaweb2/modules/monitoring/commandtransports.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[icinga2]' } - it { is_expected.to contain 'transport = "api"' } - it { is_expected.to contain 'host = "localhost"' } - it { is_expected.to contain 'port = "5665"' } - it { is_expected.to contain 'username = "root"' } - it { is_expected.to contain 'password = "icinga"' } - end - - describe file('/etc/icingaweb2/resources.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[icingaweb2-module-monitoring]' } - it { is_expected.to contain 'type = "db"' } - it { is_expected.to contain 'db = "mysql"' } - it { is_expected.to contain 'host = "localhost"' } - it { is_expected.to contain 'port = "3306"' } - it { is_expected.to contain 'dbname = "icinga2"' } - it { is_expected.to contain 'username = "icinga2"' } - it { is_expected.to contain 'password = "supersecret"' } - it { is_expected.to contain '[mysql-icingaweb2]' } - it { is_expected.to contain 'type = "db"' } - it { is_expected.to contain 'db = "mysql"' } - it { is_expected.to contain 'host = "localhost"' } - it { is_expected.to contain 'port = "3306"' } - it { is_expected.to contain 'dbname = "icingaweb2"' } - it { is_expected.to contain 'username = "icingaweb2"' } - it { is_expected.to contain 'password = "icingaweb2"' } - end - - describe file('/etc/icingaweb2/authentication.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[mysql-auth]' } - it { is_expected.to contain 'backend = "db"' } - it { is_expected.to contain 'resource = "mysql-icingaweb2"' } - - end - - describe file('/etc/icingaweb2/roles.ini') do - it { is_expected.to be_file } - it { is_expected.to contain '[default admin user]' } - it { is_expected.to contain 'users = "icingaadmin"' } - it { is_expected.to contain 'permissions = "*"' } - end - - describe command('mysql -e "select name from icingaweb2.icingaweb_user"') do - its(:stdout) { should match(%r{icingaadmin}) } - end -end diff --git a/spec/acceptance/nodesets/centos-6-x64.yml b/spec/acceptance/nodesets/centos-6-x64.yml index 0c07fe7..66613af 100644 --- a/spec/acceptance/nodesets/centos-6-x64.yml +++ b/spec/acceptance/nodesets/centos-6-x64.yml @@ -1,10 +1,10 @@ --- HOSTS: - centos-6-x64: + iw2centos6: roles: - master platform: el-6-x86_64 box: bento/centos-6 hypervisor: vagrant CONFIG: - type: aio \ No newline at end of file + type: aio diff --git a/spec/acceptance/nodesets/centos-8-x64.yml b/spec/acceptance/nodesets/centos-8-x64.yml new file mode 100644 index 0000000..4cbb5d6 --- /dev/null +++ b/spec/acceptance/nodesets/centos-8-x64.yml @@ -0,0 +1,11 @@ +--- +HOSTS: + iw2centos8: + roles: + - agent + - default + platform: el-8-x86_64 + hypervisor: vagrant + box: bento/centos-8 +CONFIG: + type: aio diff --git a/spec/acceptance/nodesets/debian-8-x64.yml b/spec/acceptance/nodesets/debian-8-x64.yml deleted file mode 100644 index 0a7c8b6..0000000 --- a/spec/acceptance/nodesets/debian-8-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -HOSTS: - debian-8-x64: - roles: - - master - platform: debian-8-amd64 - box: bento/debian-8 - hypervisor: vagrant -CONFIG: - type: foss \ No newline at end of file diff --git a/spec/acceptance/nodesets/debian-9-x64.yml b/spec/acceptance/nodesets/debian-9-x64.yml deleted file mode 100644 index 6297be9..0000000 --- a/spec/acceptance/nodesets/debian-9-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -HOSTS: - debian-9-x64: - roles: - - master - platform: debian-9-amd64 - box: bento/debian-9 - hypervisor: vagrant -CONFIG: - type: foss \ No newline at end of file diff --git a/spec/acceptance/nodesets/debian-buster-amd.yml b/spec/acceptance/nodesets/debian-buster-amd.yml new file mode 100644 index 0000000..96e9cf6 --- /dev/null +++ b/spec/acceptance/nodesets/debian-buster-amd.yml @@ -0,0 +1,12 @@ +--- +HOSTS: + iw2debian10: + roles: + - agent + - default + platform: debian-buster-amd + hypervisor: vagrant + box: bento/debian-10 + vagrant_memsize: 1024 +CONFIG: + type: aio diff --git a/spec/acceptance/nodesets/debian-stretch-amd.yml b/spec/acceptance/nodesets/debian-stretch-amd.yml new file mode 100644 index 0000000..3bed4c6 --- /dev/null +++ b/spec/acceptance/nodesets/debian-stretch-amd.yml @@ -0,0 +1,12 @@ +--- +HOSTS: + iw2debian: + roles: + - agent + - default + platform: debian-stretch-amd + hypervisor: vagrant + box: bento/debian-9 + vagrant_memsize: 1024 +CONFIG: + type: aio diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/default.yml similarity index 72% rename from spec/acceptance/nodesets/centos-7-x64.yml rename to spec/acceptance/nodesets/default.yml index 111ddb3..7fe87ed 100644 --- a/spec/acceptance/nodesets/centos-7-x64.yml +++ b/spec/acceptance/nodesets/default.yml @@ -1,10 +1,11 @@ --- HOSTS: - centos-7-x64: + iw2centos7: roles: - - master + - agent + - default platform: el-7-x86_64 - box: bento/centos-7 hypervisor: vagrant + box: bento/centos-7 CONFIG: type: aio diff --git a/spec/acceptance/nodesets/ubuntu-server-1804-x64.yml b/spec/acceptance/nodesets/ubuntu-bionic-amd.yml similarity index 66% rename from spec/acceptance/nodesets/ubuntu-server-1804-x64.yml rename to spec/acceptance/nodesets/ubuntu-bionic-amd.yml index 60ff90e..557ee18 100644 --- a/spec/acceptance/nodesets/ubuntu-server-1804-x64.yml +++ b/spec/acceptance/nodesets/ubuntu-bionic-amd.yml @@ -1,10 +1,11 @@ --- HOSTS: - ubuntu-server-1804-x64: + iw2ubuntu18: roles: - - master + - agent + - default platform: ubuntu-18.04-amd64 box: bento/ubuntu-18.04 hypervisor: vagrant CONFIG: - type: foss + type: aio diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml deleted file mode 100644 index 21c3f8c..0000000 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -HOSTS: - ubuntu-server-1404-x64: - roles: - - master - platform: ubuntu-14.04-amd64 - box: bento/ubuntu-14.04 - hypervisor: vagrant -CONFIG: - type: foss \ No newline at end of file diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-xenial-amd.yml similarity index 66% rename from spec/acceptance/nodesets/ubuntu-server-1604-x64.yml rename to spec/acceptance/nodesets/ubuntu-xenial-amd.yml index 1fe894e..90a8d39 100644 --- a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml +++ b/spec/acceptance/nodesets/ubuntu-xenial-amd.yml @@ -1,10 +1,11 @@ --- HOSTS: - ubuntu-server-1604-x64: + iw2ubuntu16: roles: - - master + - agent + - default platform: ubuntu-16.04-amd64 box: bento/ubuntu-16.04 hypervisor: vagrant CONFIG: - type: foss \ No newline at end of file + type: aio diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 96855f3..a957ce6 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,31 +1,51 @@ require 'beaker-rspec' require 'beaker/puppet_install_helper' -require 'beaker/module_install_helper' -run_puppet_install_helper +# Install Puppet on all hosts +install_puppet_agent_on(hosts, :puppet_collection => 'puppet5') RSpec.configure do |c| - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) c.formatter = :documentation - install_module_from_forge('puppetlabs-stdlib', '>= 4.16.0 < 6.0.0') - install_module_from_forge('puppetlabs-concat', '>= 2.0.1 < 6.0.0') - install_module_from_forge('puppetlabs-vcsrepo', '>= 1.3.0 < 3.0.0') - - install_module_from_forge('puppetlabs-mysql', '>= 2.2.0') - install_module_from_forge('puppetlabs-apache', '>= 1.11.0') - install_module_from_forge('puppet-zypprepo', '>= 2.0.0') - install_module_from_forge('puppetlabs-apt', '>= 2.0.0') - install_module_from_forge('puppetlabs-yumrepo_core', '>= 1.0.0') - c.before :suite do + # Install module to all hosts hosts.each do |host| - copy_module_to(host, source: proj_root, module_name: 'icingaweb2') - if fact('osfamily') == 'RedHat' - # Soft dep on epel for Passenger - install_package(host, 'epel-release') + install_dev_puppet_module_on(host, :source => module_root, :module_name => 'icingaweb2', + :target_module_path => '/etc/puppetlabs/code/modules') + + # Install dependencies + on(host, puppet('module', 'install', 'puppetlabs-stdlib')) + on(host, puppet('module', 'install', 'puppetlabs-concat')) + on(host, puppet('module', 'install', 'puppetlabs-vcsrepo')) + + # Install additional modules + on(host, puppet('module', 'install', 'puppetlabs-mysql')) + on(host, puppet('module', 'install', 'puppetlabs-postgresql')) + on(host, puppet('module', 'install', 'puppetlabs-apache')) + on(host, puppet('module', 'install', 'puppet-php')) + + if fact('osfamily') == 'Debian' + on(host, puppet('module', 'install', 'puppetlabs-apt')) + end + + if fact('osfamily') == 'Suse' + on(host, puppet('module', 'install', 'puppet-zypprepo')) end + + # Add more setup code as needed end end end + +shared_examples 'a idempotent resource' do + it 'applies with no errors' do + apply_manifest(pp, catch_failures: true) + end + + it 'applies a second time without changes', :skip_pup_5016 do + apply_manifest(pp, catch_changes: true) + end +end +