diff options
author | Patrick Wright <patrick@getchef.com> | 2015-10-06 12:21:35 -0700 |
---|---|---|
committer | Patrick Wright <patrick@getchef.com> | 2015-10-06 12:21:35 -0700 |
commit | ea9e467fecfde71b934c0cd397804bfc3a994a2c (patch) | |
tree | 0fa6b6a31653ad673429e7c7e5b64a563cc92970 | |
parent | e9301daba5ca25c5f5bbe5c84080c6559b39b12a (diff) | |
download | chef-ea9e467fecfde71b934c0cd397804bfc3a994a2c.tar.gz |
remove kitchen-tests from acceptance
36 files changed, 1 insertions, 713 deletions
diff --git a/acceptance/.chef/client.rb b/acceptance/.chef/client.rb deleted file mode 100644 index be46e2e8d7..0000000000 --- a/acceptance/.chef/client.rb +++ /dev/null @@ -1,10 +0,0 @@ - -chef_dir = File.expand_path(File.dirname(__FILE__)) -repo_dir = File.expand_path(File.join(chef_dir, '..')) - -log_level :info -chef_repo_path repo_dir -local_mode true -cache_path "#{ENV['HOME']}/.cache/chef" - -audit_mode :enabled
\ No newline at end of file diff --git a/acceptance/.kitchen.yml b/acceptance/.kitchen.yml index 849088a28c..887ff7d3f3 100644 --- a/acceptance/.kitchen.yml +++ b/acceptance/.kitchen.yml @@ -8,28 +8,9 @@ driver: provisioner: name: chef_zero # Will eventually be configured to download from omnitruck/current - data_path: test/fixtures platforms: - # upstream community mysql cookbook broken on 10.04 - #- name: ubuntu-10.04 - # run_list: apt::default - # - name: ubuntu-12.04 - # run_list: apt::default - name: ubuntu-14.04 - run_list: apt::default - # upstream community mysql cookbook also broken on 14.10 - #- name: ubuntu-14.10 - # run_list: apt::default - # - name: centos-6.4 - # run_list: yum-epel::default - # - name: centos-5.10 - # run_list: yum-epel::default suites: - - name: webapp - run_list: - - recipe[apt::default] - - recipe[webapp::default] - attributes: - name: acceptance diff --git a/acceptance/Berksfile b/acceptance/Berksfile deleted file mode 100644 index 66569ed97f..0000000000 --- a/acceptance/Berksfile +++ /dev/null @@ -1,3 +0,0 @@ -source "https://supermarket.getchef.com" - -cookbook "webapp", :path => "cookbooks/webapp" diff --git a/acceptance/Gemfile b/acceptance/Gemfile index 6b7137c7f0..41ce8f2f78 100644 --- a/acceptance/Gemfile +++ b/acceptance/Gemfile @@ -3,7 +3,5 @@ source 'https://rubygems.org' gem 'chef-acceptance', github: 'chef/chef-acceptance' gem 'berkshelf' gem 'test-kitchen', '~> 1.4.0' -gem 'kitchen-appbundle-updater', '~> 0.0.1' -gem "kitchen-vagrant", '~> 0.17.0' -gem 'kitchen-ec2', github: 'test-kitchen/kitchen-ec2' +gem 'kitchen-vagrant', '~> 0.17.0' gem 'vagrant-wrapper' diff --git a/acceptance/cookbooks/audit_test/.gitignore b/acceptance/cookbooks/audit_test/.gitignore deleted file mode 100644 index ec2a890bd3..0000000000 --- a/acceptance/cookbooks/audit_test/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -.vagrant -Berksfile.lock -*~ -*# -.#* -\#*# -.*.sw[a-z] -*.un~ - -# Bundler -Gemfile.lock -bin/* -.bundle/* - -.kitchen/ -.kitchen.local.yml diff --git a/acceptance/cookbooks/audit_test/.kitchen.yml b/acceptance/cookbooks/audit_test/.kitchen.yml deleted file mode 100644 index be11e33081..0000000000 --- a/acceptance/cookbooks/audit_test/.kitchen.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -driver: - name: vagrant - -provisioner: - name: chef_zero - -platforms: - - name: ubuntu-12.04 - - name: centos-6.5 - -suites: - - name: default - run_list: - - recipe[audit_test::default] - attributes: diff --git a/acceptance/cookbooks/audit_test/Berksfile b/acceptance/cookbooks/audit_test/Berksfile deleted file mode 100644 index 0ac9b78cf7..0000000000 --- a/acceptance/cookbooks/audit_test/Berksfile +++ /dev/null @@ -1,3 +0,0 @@ -source "https://supermarket.getchef.com" - -metadata diff --git a/acceptance/cookbooks/audit_test/README.md b/acceptance/cookbooks/audit_test/README.md deleted file mode 100644 index 75e2f44808..0000000000 --- a/acceptance/cookbooks/audit_test/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# audit_test - -This cookbook has some basic recipes to test audit mode. - -In order to run these tests on your dev box: - -``` -$ bundle install -$ bundle exec chef-client -c kitchen-tests/.chef/client.rb -z -o audit_test::default -l debug -``` - -Expected JSON output for the tests will be printed to `debug` log. diff --git a/acceptance/cookbooks/audit_test/chefignore b/acceptance/cookbooks/audit_test/chefignore deleted file mode 100644 index 80dc2d20ef..0000000000 --- a/acceptance/cookbooks/audit_test/chefignore +++ /dev/null @@ -1,95 +0,0 @@ -# Put files/directories that should be ignored in this file when uploading -# or sharing to the community site. -# Lines that start with '# ' are comments. - -# OS generated files # -###################### -.DS_Store -Icon? -nohup.out -ehthumbs.db -Thumbs.db - -# SASS # -######## -.sass-cache - -# EDITORS # -########### -\#* -.#* -*~ -*.sw[a-z] -*.bak -REVISION -TAGS* -tmtags -*_flymake.* -*_flymake -*.tmproj -.project -.settings -mkmf.log - -## COMPILED ## -############## -a.out -*.o -*.pyc -*.so -*.com -*.class -*.dll -*.exe -*/rdoc/ - -# Testing # -########### -.watchr -.rspec -spec/* -spec/fixtures/* -test/* -features/* -Guardfile -Procfile - -# SCM # -####### -.git -*/.git -.gitignore -.gitmodules -.gitconfig -.gitattributes -.svn -*/.bzr/* -*/.hg/* -*/.svn/* - -# Berkshelf # -############# -Berksfile -Berksfile.lock -cookbooks/* -tmp - -# Cookbooks # -############# -CONTRIBUTING - -# Strainer # -############ -Colanderfile -Strainerfile -.colander -.strainer - -# Vagrant # -########### -.vagrant -Vagrantfile - -# Travis # -########## -.travis.yml diff --git a/acceptance/cookbooks/audit_test/metadata.rb b/acceptance/cookbooks/audit_test/metadata.rb deleted file mode 100644 index 4a60104e92..0000000000 --- a/acceptance/cookbooks/audit_test/metadata.rb +++ /dev/null @@ -1,8 +0,0 @@ -name 'audit_test' -maintainer 'The Authors' -maintainer_email 'you@example.com' -license 'all_rights' -description 'Installs/Configures audit_test' -long_description 'Installs/Configures audit_test' -version '0.1.0' - diff --git a/acceptance/cookbooks/audit_test/recipes/default.rb b/acceptance/cookbooks/audit_test/recipes/default.rb deleted file mode 100644 index 833c12064a..0000000000 --- a/acceptance/cookbooks/audit_test/recipes/default.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Cookbook Name:: audit_test -# Recipe:: default -# -# Copyright (c) 2014 The Authors, All Rights Reserved. - -control_group "basic control group" do - control "basic math" do - it "should pass" do - expect(2 - 2).to eq(0) - end - end -end - -control_group "control group without top level control" do - it "should pass" do - expect(2 - 2).to eq(0) - end -end - -control_group "control group with empty control" do - control "empty" -end - -control_group "empty control group with block" do -end diff --git a/acceptance/cookbooks/audit_test/recipes/error_duplicate_control_groups.rb b/acceptance/cookbooks/audit_test/recipes/error_duplicate_control_groups.rb deleted file mode 100644 index 82b358d4be..0000000000 --- a/acceptance/cookbooks/audit_test/recipes/error_duplicate_control_groups.rb +++ /dev/null @@ -1,17 +0,0 @@ -# -# Cookbook Name:: audit_test -# Recipe:: error_duplicate_control_groups -# -# Copyright (c) 2014 The Authors, All Rights Reserved. - -control_group "basic control group" do - it "should pass" do - expect(2 - 2).to eq(0) - end -end - -control_group "basic control group" do - it "should pass" do - expect(2 - 2).to eq(0) - end -end diff --git a/acceptance/cookbooks/audit_test/recipes/error_no_block.rb b/acceptance/cookbooks/audit_test/recipes/error_no_block.rb deleted file mode 100644 index 42da81aa4f..0000000000 --- a/acceptance/cookbooks/audit_test/recipes/error_no_block.rb +++ /dev/null @@ -1,7 +0,0 @@ -# -# Cookbook Name:: audit_test -# Recipe:: error_no_block -# -# Copyright (c) 2014 The Authors, All Rights Reserved. - -control_group "empty control group without block" diff --git a/acceptance/cookbooks/audit_test/recipes/error_orphan_control.rb b/acceptance/cookbooks/audit_test/recipes/error_orphan_control.rb deleted file mode 100644 index 4f2a8e6c55..0000000000 --- a/acceptance/cookbooks/audit_test/recipes/error_orphan_control.rb +++ /dev/null @@ -1,13 +0,0 @@ -# -# Cookbook Name:: audit_test -# Recipe:: error_orphan_control -# -# Copyright (c) 2014 The Authors, All Rights Reserved. - -control_group "basic control group" do - it "should pass" do - expect(2 - 2).to eq(0) - end -end - -control "orphan control" diff --git a/acceptance/cookbooks/audit_test/recipes/failed_specs.rb b/acceptance/cookbooks/audit_test/recipes/failed_specs.rb deleted file mode 100644 index c5c2c32f0a..0000000000 --- a/acceptance/cookbooks/audit_test/recipes/failed_specs.rb +++ /dev/null @@ -1,14 +0,0 @@ -# -# Cookbook Name:: audit_test -# Recipe:: failed_specs -# -# Copyright (c) 2014 The Authors, All Rights Reserved. - -control_group "basic control group" do - control "basic math" do - # Can not write a good control :( - it "should pass" do - expect(2 - 0).to eq(0) - end - end -end diff --git a/acceptance/cookbooks/audit_test/recipes/serverspec_collision.rb b/acceptance/cookbooks/audit_test/recipes/serverspec_collision.rb deleted file mode 100644 index c433bd1a90..0000000000 --- a/acceptance/cookbooks/audit_test/recipes/serverspec_collision.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# Cookbook Name:: audit_test -# Recipe:: serverspec_collision -# -# Copyright (c) 2014 The Authors, All Rights Reserved. - -file "/tmp/audit_test_file" do - action :create - content "Welcome to audit mode." -end - -control_group "file auditing" do - describe "test file" do - it "says welcome" do - expect(file("/tmp/audit_test_file")).to contain("Welcome") - end - end -end - -file "/tmp/audit_test_file_2" do - action :create - content "Bye to audit mode." -end - -control_group "end file auditing" do - describe "end file" do - it "says bye" do - expect(file("/tmp/audit_test_file_2")).to contain("Bye") - end - end -end diff --git a/acceptance/cookbooks/audit_test/recipes/serverspec_support.rb b/acceptance/cookbooks/audit_test/recipes/serverspec_support.rb deleted file mode 100644 index 8b3c35a6bd..0000000000 --- a/acceptance/cookbooks/audit_test/recipes/serverspec_support.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Cookbook Name:: audit_test -# Recipe:: serverspec_support -# -# Copyright (c) 2014 The Authors, All Rights Reserved. - -file "/tmp/audit_test_file" do - action :create - content "Welcome to audit mode." -end - -# package "curl" do -# action :install -# end - -control_group "serverspec helpers with types" do - control "file helper" do - it "says welcome" do - expect(file("/tmp/audit_test_file")).to contain("Welcome") - end - end - - control service("com.apple.CoreRAID") do - it { is_expected.to be_enabled } - it { is_expected.not_to be_running } - end - - # describe "package helper" do - # it "works" do - # expect(package("curl")).to be_installed - # end - # end - - control package("postgresql") do - it { is_expected.to_not be_installed } - end -end diff --git a/acceptance/cookbooks/audit_test/recipes/with_include_recipe.rb b/acceptance/cookbooks/audit_test/recipes/with_include_recipe.rb deleted file mode 100644 index f795f7786a..0000000000 --- a/acceptance/cookbooks/audit_test/recipes/with_include_recipe.rb +++ /dev/null @@ -1,16 +0,0 @@ -# -# Cookbook Name:: audit_test -# Recipe:: with_include_recipe -# -# Copyright (c) 2014 The Authors, All Rights Reserved. - -include_recipe "audit_test::serverspec_collision" - -control_group "basic example" do - it "should pass" do - expect(2 - 2).to eq(0) - end -end - -include_recipe "audit_test::serverspec_collision" -include_recipe "audit_test::default" diff --git a/acceptance/cookbooks/webapp/Berksfile b/acceptance/cookbooks/webapp/Berksfile deleted file mode 100644 index 4b6079016e..0000000000 --- a/acceptance/cookbooks/webapp/Berksfile +++ /dev/null @@ -1,5 +0,0 @@ -source "https://api.berkshelf.com" - -metadata - -cookbook "apt" diff --git a/acceptance/cookbooks/webapp/README.md b/acceptance/cookbooks/webapp/README.md deleted file mode 100644 index f19ab46735..0000000000 --- a/acceptance/cookbooks/webapp/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# webapp - -TODO: Enter the cookbook description here. diff --git a/acceptance/cookbooks/webapp/attributes/default.rb b/acceptance/cookbooks/webapp/attributes/default.rb deleted file mode 100644 index fb33efa49e..0000000000 --- a/acceptance/cookbooks/webapp/attributes/default.rb +++ /dev/null @@ -1,14 +0,0 @@ -default['apache']['remote_host_ip'] = '127.0.0.1' - -default['webapp']['database'] = 'webapp' -default['webapp']['db_username'] = 'webapp' -default['webapp']['path'] = '/srv/webapp' - -# XXX: apache2 cookbook 2.0.0 has bugs around changing the mpm and then attempting a graceful restart -# which fails and leaves the service down. -case node['platform'] -when "ubuntu" - if node['platform_version'].to_f >= 14.04 - default[:apache][:mpm] = 'event' - end -end diff --git a/acceptance/cookbooks/webapp/metadata.rb b/acceptance/cookbooks/webapp/metadata.rb deleted file mode 100644 index c26ad23979..0000000000 --- a/acceptance/cookbooks/webapp/metadata.rb +++ /dev/null @@ -1,12 +0,0 @@ -name 'webapp' -maintainer '' -maintainer_email '' -license '' -description 'Installs/Configures webapp' -long_description 'Installs/Configures webapp' -version '0.1.0' - -depends 'apache2' -depends 'database', '~> 2.3.1' -depends 'mysql' -depends 'php' diff --git a/acceptance/cookbooks/webapp/recipes/default.rb b/acceptance/cookbooks/webapp/recipes/default.rb deleted file mode 100644 index 839b0ad8d8..0000000000 --- a/acceptance/cookbooks/webapp/recipes/default.rb +++ /dev/null @@ -1,64 +0,0 @@ -# -# Cookbook Name:: webapp -# Recipe:: default -# -# Copyright (C) 2014 -# - -include_recipe "apache2" -include_recipe "database::mysql" -include_recipe "php" - -creds = Hash.new -%w(mysql webapp).each do |item_name| - creds[item_name] = data_bag_item('passwords', item_name) -end - -web_app "webapp" do - server_name 'localhost' - server_aliases [node['fqdn'], node['hostname'], 'localhost.localdomain'] - docroot node['webapp']['path'] - cookbook 'apache2' -end - -mysql_service "default" do - server_root_password creds['mysql']['server_root_password'] - server_repl_password creds['mysql']['server_repl_password'] -end - -mysql_database node['webapp']['database'] do - connection ({ - :host => 'localhost', - :username => 'root', - :password => creds['mysql']['server_root_password'] - }) - action :create -end - -mysql_database_user node['webapp']['db_username'] do - connection ({ - :host => 'localhost', - :username => 'root', - :password => creds['mysql']['server_root_password'] - }) - password creds['webapp']['db_password'] - database_name node['webapp']['database'] - privileges [:select, :update, :insert, :create, :delete] - action :grant -end - -directory node['webapp']['path'] do - owner "root" - group "root" - mode "0755" - action :create - recursive true -end - -template "#{node['webapp']['path']}/index.html" do - source 'index.html.erb' -end - -template "#{node['webapp']['path']}/index.php" do - source 'index.php.erb' -end diff --git a/acceptance/cookbooks/webapp/templates/default/index.html.erb b/acceptance/cookbooks/webapp/templates/default/index.html.erb deleted file mode 100644 index 6da0629b9e..0000000000 --- a/acceptance/cookbooks/webapp/templates/default/index.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<html> - <body> - <h1>Hello, World!</h1> - </body> -</html> diff --git a/acceptance/cookbooks/webapp/templates/default/index.php.erb b/acceptance/cookbooks/webapp/templates/default/index.php.erb deleted file mode 100644 index b08b076614..0000000000 --- a/acceptance/cookbooks/webapp/templates/default/index.php.erb +++ /dev/null @@ -1,8 +0,0 @@ -<html> - <head> - <title>PHP Test</title> - </head> - <body> - <?php echo '<p>Hello, World!</p>'; ?> - </body> -</html> diff --git a/acceptance/data_bags/passwords/mysql.json b/acceptance/data_bags/passwords/mysql.json deleted file mode 100644 index af02a6a858..0000000000 --- a/acceptance/data_bags/passwords/mysql.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": "mysql", - "server_root_password": "ilikerandompasswordstoo", - "server_repl_password": "itoolikerandompasswords" -} diff --git a/acceptance/data_bags/passwords/webapp.json b/acceptance/data_bags/passwords/webapp.json deleted file mode 100644 index 43c0ae1ced..0000000000 --- a/acceptance/data_bags/passwords/webapp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "id": "webapp", - "db_password": "supersecretdbpassword" -} diff --git a/acceptance/test/fixtures/platforms/centos/5.json b/acceptance/test/fixtures/platforms/centos/5.json deleted file mode 100644 index 9d324a2f03..0000000000 --- a/acceptance/test/fixtures/platforms/centos/5.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "apache": { - "package": "httpd", - "service_name": "httpd" - }, - "mysql": { - "server_package": "mysql-server", - "client_package": "mysql", - "service_name": "mysqld" - }, - "php" : { - "package": "php53" - } -} diff --git a/acceptance/test/fixtures/platforms/centos/6.json b/acceptance/test/fixtures/platforms/centos/6.json deleted file mode 100644 index 4f74a3ed4a..0000000000 --- a/acceptance/test/fixtures/platforms/centos/6.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "apache": { - "package": "httpd", - "service_name": "httpd" - }, - "mysql": { - "server_package": "mysql-server", - "client_package": "mysql", - "service_name": "mysqld" - }, - "php" : { - "package": "php" - } -} diff --git a/acceptance/test/fixtures/platforms/ubuntu/10.04.json b/acceptance/test/fixtures/platforms/ubuntu/10.04.json deleted file mode 100644 index a9677c7ca5..0000000000 --- a/acceptance/test/fixtures/platforms/ubuntu/10.04.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "apache": { - "package": "apache2", - "service_name": "apache2" - }, - "mysql": { - "server_package": "mysql-server-5.1", - "client_package": "mysql-client-5.1", - "service_name": "mysql" - }, - "php" : { - "package": "php5" - } -} diff --git a/acceptance/test/fixtures/platforms/ubuntu/12.04.json b/acceptance/test/fixtures/platforms/ubuntu/12.04.json deleted file mode 100644 index eab46db2e5..0000000000 --- a/acceptance/test/fixtures/platforms/ubuntu/12.04.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "apache": { - "package": "apache2", - "service_name": "apache2" - }, - "mysql": { - "server_package": "mysql-server-5.5", - "client_package": "mysql-client-5.5", - "service_name": "mysql" - }, - "php" : { - "package": "php5" - } -} diff --git a/acceptance/test/fixtures/platforms/ubuntu/14.04.json b/acceptance/test/fixtures/platforms/ubuntu/14.04.json deleted file mode 100644 index eab46db2e5..0000000000 --- a/acceptance/test/fixtures/platforms/ubuntu/14.04.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "apache": { - "package": "apache2", - "service_name": "apache2" - }, - "mysql": { - "server_package": "mysql-server-5.5", - "client_package": "mysql-client-5.5", - "service_name": "mysql" - }, - "php" : { - "package": "php5" - } -} diff --git a/acceptance/test/fixtures/platforms/ubuntu/14.10.json b/acceptance/test/fixtures/platforms/ubuntu/14.10.json deleted file mode 100644 index eab46db2e5..0000000000 --- a/acceptance/test/fixtures/platforms/ubuntu/14.10.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "apache": { - "package": "apache2", - "service_name": "apache2" - }, - "mysql": { - "server_package": "mysql-server-5.5", - "client_package": "mysql-client-5.5", - "service_name": "mysql" - }, - "php" : { - "package": "php5" - } -} diff --git a/acceptance/test/fixtures/serverspec_helper.rb b/acceptance/test/fixtures/serverspec_helper.rb deleted file mode 100644 index ad1f866775..0000000000 --- a/acceptance/test/fixtures/serverspec_helper.rb +++ /dev/null @@ -1,32 +0,0 @@ -# Shamelessly copied from https://github.com/onehealth-cookbooks/apache2/blob/master/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' -require 'ffi_yajl' - -set :backend, :exec - -include Specinfra::Helper::Properties - -require 'pp' -pp os - -def load_nodestub - case os[:family] - when 'ubuntu', 'debian' - platform = os[:family] - platform_version = os[:release] - when 'redhat' - platform = 'centos' - platform_version = os[:release].to_i - end - FFI_Yajl::Parser.parse(IO.read("#{ENV['BUSSER_ROOT']}/../kitchen/data/platforms/#{platform}/#{platform_version}.json"), :symbolize_names => true) -end - -# centos-59 doesn't have /sbin in the default path, -# so we must ensure it's on serverspec's path -set :path, '$PATH:/sbin' - -set_property load_nodestub diff --git a/acceptance/test/integration/webapp/serverspec/Gemfile b/acceptance/test/integration/webapp/serverspec/Gemfile deleted file mode 100644 index 0cb00ce354..0000000000 --- a/acceptance/test/integration/webapp/serverspec/Gemfile +++ /dev/null @@ -1,4 +0,0 @@ -# This Gemfile is only needed so that busser will install gems it needs for serverspec_helper.rb to work -source "https://rubygems.org" - -gem 'ffi-yajl', '~> 1.1' # Go away, JSON gem diff --git a/acceptance/test/integration/webapp/serverspec/localhost/default_spec.rb b/acceptance/test/integration/webapp/serverspec/localhost/default_spec.rb deleted file mode 100644 index 64c9121a6f..0000000000 --- a/acceptance/test/integration/webapp/serverspec/localhost/default_spec.rb +++ /dev/null @@ -1,127 +0,0 @@ - -require "net/http" -require "uri" - -require "#{ENV['BUSSER_ROOT']}/../kitchen/data/serverspec_helper" - -describe "webapp::default", :end_to_end => true do - - describe "installed packages" do - shared_examples_for "a package" do - it "is installed" do - expect(package(package_name)).to be_installed - end - end - - describe "#{property[:apache][:package]} package" do - include_examples "a package" do - let(:package_name) { property[:apache][:package] } - end - end - - describe "#{property[:mysql][:server_package]} package" do - include_examples "a package" do - let(:package_name) { property[:mysql][:server_package] } - end - end - - describe "#{property[:mysql][:client_package]} package" do - include_examples "a package" do - let(:package_name) { property[:mysql][:client_package] } - end - end - - describe "php package" do - include_examples "a package" do - let(:package_name) { property[:php][:package] } - end - end - end - - describe "enabled/running services" do - shared_examples_for "a service" do - it "is enabled" do - expect(service(service_name)).to be_enabled - end - - it "is running" do - expect(service(service_name)).to be_enabled - end - end - - describe "#{property[:apache][:service_name]} service" do - include_examples "a service" do - let(:service_name) { property[:apache][:service_name] } - end - end - - describe "mysql service" do - include_examples "a service" do - let(:service_name) { property[:mysql][:service_name] } - end - end - - end - - describe "mysql database" do - let(:db_query) { "mysql -u root -pilikerandompasswordstoo -e \"#{statement}\"" } - let(:statement) { "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='webapp'" } - it "creates a database called 'webapp'" do - expect(command(db_query).stdout).to match /webapp/ - end - - describe "mysql database user 'webapp'" do - let(:statement) { "SELECT Host, Db FROM mysql.db WHERE User='webapp'\\G" } - it "adds user 'webapp' to database 'webapp@localhost'" do - expect(command(db_query).stdout).to match /Host: localhost\n Db: webapp/ - end - - describe "grants" do - shared_examples_for "a privilege" do |priv| - let(:statement) { - "SELECT #{priv_query}" \ - " FROM mysql.db" \ - " WHERE Host='localhost' AND Db='webapp' AND User='webapp'\\G" - } - let(:priv_query) { "#{priv.capitalize}_priv" } - - it "has privilege #{priv} on 'webapp@localhost'" do - expect(command(db_query).stdout).to match /#{priv_query}: Y/ - end - end - - %w(select update insert delete create).each do |priv| - include_examples "a privilege", priv do - end - end - end - end - end - - describe "generated webpages" do - let(:get_response) { Net::HTTP.get_response(uri) } - shared_examples_for "a webpage" do - it "exists" do - expect(get_response).to be_kind_of(Net::HTTPSuccess) - end - - it "displays content" do - expect(get_response.body).to include(content) - end - end - - describe "http://localhost/index.html" do - include_examples "a webpage" do - let(:uri) { URI.parse("http://localhost/index.html") } - let(:content) { "Hello, World!" } - end - end - - describe "http://localhost/index.php" do - include_examples "a webpage" do - let(:uri) { URI.parse("http://localhost/index.php") } - let(:content) { "Hello, World!" } - end - end - end -end |