diff options
author | Claire McQuin <claire@getchef.com> | 2014-08-06 14:19:17 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-08-13 09:21:20 -0700 |
commit | 730a41775850f22bf76cc60ce31065d2bfc6b3fe (patch) | |
tree | 44d38344c1f6e5b808154ed565ecab6edfa1ebfd /kitchen-tests/test/fixtures | |
parent | 0bbddd62b0c65781eacd43f2ca3334a1ed23c09e (diff) | |
download | chef-730a41775850f22bf76cc60ce31065d2bfc6b3fe.tar.gz |
Remove kitchen tests from spec/ directory, so tests can be run separately.
Diffstat (limited to 'kitchen-tests/test/fixtures')
-rw-r--r-- | kitchen-tests/test/fixtures/platforms/ubuntu/12.04.json | 42 | ||||
-rw-r--r-- | kitchen-tests/test/fixtures/serverspec_helper.rb | 74 |
2 files changed, 116 insertions, 0 deletions
diff --git a/kitchen-tests/test/fixtures/platforms/ubuntu/12.04.json b/kitchen-tests/test/fixtures/platforms/ubuntu/12.04.json new file mode 100644 index 0000000000..5e436a3cb0 --- /dev/null +++ b/kitchen-tests/test/fixtures/platforms/ubuntu/12.04.json @@ -0,0 +1,42 @@ +{ + "apache": { + "package": "apache2", + "binary": "/usr/sbin/apache2", + "dir": "/etc/apache2", + "lib_dir": "/usr/lib/apache2", + "libexec_dir": "/usr/lib/apache2/modules", + "cache_dir": "/var/cache/apache2", + "cgibin_dir": "/usr/lib/cgi-bin", + "docroot_dir": "/var/www", + "conf": "/etc/apache2/apache2.conf", + "perl_pkg": "perl", + "log_dir": "/var/log/apache2", + "root_group": "root", + "service_name": "apache2", + "service_restart_command": "/usr/sbin/invoke-rc.d apache2 restart && sleep 1", + "service_reload_command": "/usr/sbin/invoke-rc.d apache2 reload && sleep 1", + "default_site_name": "000-default", + "default_site_enabled": false, + "default_modules": [ + "status", + "alias", + "auth_basic", + "authn_file", + "authz_core", + "authz_groupfile", + "authz_host", + "authz_user", + "autoindex", + "dir", + "env", + "mime", + "negotiation", + "setenvif" + ] + }, + "mysql": { + "server": { + "version": "5.5" + } + } +} diff --git a/kitchen-tests/test/fixtures/serverspec_helper.rb b/kitchen-tests/test/fixtures/serverspec_helper.rb new file mode 100644 index 0000000000..3a2c05f9cf --- /dev/null +++ b/kitchen-tests/test/fixtures/serverspec_helper.rb @@ -0,0 +1,74 @@ +# Shamelessly copied from opscode/onehealth-cookbooks/apache2/test/fixtures/serverspec_helper.rb +# The commented-out platforms in the osmapping hash can be added once we have added them into +# our .kitchen.yml and .kitchen.travis.yml and added the appropriate JSON under test/fixtures/platforms. + +require 'serverspec' +require 'json' + +include SpecInfra::Helper::Exec +include SpecInfra::Helper::DetectOS +include SpecInfra::Helper::Properties + +# http://serverspec.org/advanced_tips.html +# os[:family] # RedHat, Ubuntu, Debian and so on +# os[:release] # OS release version (cleaned up in v2) +# os[:arch] +osmapping = { +# 'RedHat' => { +# :platform_family => 'rhel', +# :platform => 'centos', +# :platform_version => '6.5' +# }, +# 'RedHat7' => { +# :platform_family => 'rhel', +# :platform => 'centos', +# :platform_version => '7.0' +# }, +# 'Fedora' => { +# :platform_family => 'rhel', +# :platform => 'fedora', +# :platform_version => '20' +# }, + 'Ubuntu' => { + :platform_family => 'debian', + :platform => 'ubuntu', + :platform_version => '12.04' + } +# 'Debian' => { +# :platform_family => 'debian', +# :platform => 'debian', +# :platform_version => '7.4' +# }, +# 'FreeBSD' => { +# :platform_family => 'freebsd', +# :platform => 'freebsd', +# :platform_version => '9.2' +# } +} + +def ohai_platform(os, osmapping) + puts "serverspec os detected as: #{os[:family]} #{os[:release]} [#{os[:arch]}]" + ohaistub = {} + ohaistub[:platform_family] = osmapping[os[:family]][:platform_family] + ohaistub[:platform] = osmapping[os[:family]][:platform] + if os[:release] + ohaistub[:platform_version] = os[:release] + else + ohaistub[:platform_version] = osmapping[os[:family]][:platform_version] + end + ohaistub +end + +def load_nodestub(ohai) + puts "loading #{ohai[:platform]}/#{ohai[:platform_version]}" + JSON.parse(IO.read("#{ENV['BUSSER_ROOT']}/../kitchen/data/platforms/#{ohai[:platform]}/#{ohai[:platform_version]}.json"), :symbolize_names => true) +end + +RSpec.configure do |config| + set_property load_nodestub(ohai_platform(backend.check_os, osmapping)) + config.before(:all) do + # centos-59 doesn't have /sbin in the default path, + # so we must ensure it's on serverspec's path + config.path = '/sbin' + end +end |