diff options
author | Claire McQuin <mcquin@users.noreply.github.com> | 2014-08-13 09:21:50 -0700 |
---|---|---|
committer | Claire McQuin <mcquin@users.noreply.github.com> | 2014-08-13 09:21:50 -0700 |
commit | 9e0a614d6251d31a08c48c98b1699dadca221acd (patch) | |
tree | 518245010dc7eaab69592b625fdc7c9b35dba5bc | |
parent | 6ad12bac9cd0b736915dcafe9232d168bc1e0dc6 (diff) | |
parent | e03d491e2df049cc7cc475264601adf2c770ac5b (diff) | |
download | chef-9e0a614d6251d31a08c48c98b1699dadca221acd.tar.gz |
Merge pull request #1764 from opscode/mcquin/ubuntu-tests
Create a cookbook and test it on Ubuntu 12.04
28 files changed, 492 insertions, 111 deletions
diff --git a/.travis.yml b/.travis.yml index aeaa9595ea..324edcadc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,12 +27,13 @@ matrix: - rvm: 2.1.1 gemfile: pedant.gemfile script: bundle exec rake pedant + ### START TEST KITCHEN ONLY ### - rvm: 2.1.1 - gemfile: spec/e2e/Gemfile + gemfile: kitchen-tests/Gemfile before_install: - echo -n $DO_KEY_CHUNK_{0..30} >> ~/.ssh/id_aws.base64 - cat ~/.ssh/id_aws.base64 | tr -d ' ' | base64 --decode > ~/.ssh/id_aws.pem - before_script: cd spec/e2e + before_script: cd kitchen-tests script: - bundle exec kitchen test after_script: @@ -70,7 +71,7 @@ matrix: - secure: QHuMdtFCvttiIOx6iS+lH4bKXZMwsgVQ6FPsUW5zJ7uw6mAEWKEil9xNk4aYV9FywinwUs4fnFlnIW/Gj1gLkUjm4DtxdmRZIlRXIbgsNch6H916TCPg4Q2oPsW2nVdXPjW/2jhkfLUiSnuhL+ylami1NF8Up7vokXknh/jFNZU= - secure: GTfrUVmMQSxho3Ia4Y1ONqKvVMD34GHF2/TJb8UdQV7iH+nVxVXpy3nWaCXa9ri7lRzMefkoVLy0gKK13YoVd7w3d2S3/IfNakC85XfN6VuOzK/FDkA0WoPrgKjcQ64I+3dQ6cgrMWWTieKwRZy+Ve24iRbnN055Hk+VRMu6OGw= - secure: SOMYGVfHLkHsH6koxpw68YQ4ydEo6YXPhHbrYGQbehUbFa6+OZzBcAJRJbKjyhD2AZRvNr2jB8XnjYKvVyDGQRpkWhGYZ7CpHqINpDsqKBsbiMe3/+KmKQqS+UKxNGefquoOvyQ1N8Xy77dkWYokRtGMEuR12RkZLonxiDW8Qyg= - + ### END TEST KITCHEN ONLY ### notifications: on_success: change on_failure: always diff --git a/CHANGELOG.md b/CHANGELOG.md index 3221d3cbc9..1fc5858b06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,28 @@ knife diagnostic messages sent to stdout instead of stderr * [**Xabier de Zuazo**](https://github.com/zuazo): Remove the unused StreamingCookbookUploader class (CHEF-4586) + + +* log resource now marks itself as supporting why-run +* http_request no longer appends "?message=" query string to GET and HEAD requests +* added shell_out commands directly to the recipe DSL +* cookbook synchronizer deletes old files from cookbooks +* do not clear file cache when override run list is set (CHEF-3684) +* ruby 1.8.7/1.9.1/1.9.2 support is dropped +* set no_lazy_load to true (CHEF-4961) +* set file_stating_uses_destdir config option default to true (CHEF-5040) +* remove dependency on rest-client gem +* Add method shell_out_with_systems_locale to ShellOut. +* Fix knife cookbook site share on windows (CHEF-4994) +* chef-repo rake tasks are deprecated; print relevant information for + each one. +* Fix RPM package version detection (Issue 1554) +* Don't override :default provider map if :default passed as platform (OC-11667). +* Fix SuSE package removal failure (Issue 1732). +* Enable Travis to run Test Kitchen with Kitchen EC2. +* End-to-end tests for Ubuntu 12.04 + + * [**Phil Dibowitz**](https://github.com/jaymzh): 'group' provider on OSX properly uses 'dscl' to determine existing groups * [**Hugo Lopes Tavares**](https://github.com/hltbra): diff --git a/spec/e2e/.chef/client.rb b/kitchen-tests/.chef/client.rb index 5eb200a939..5eb200a939 100644 --- a/spec/e2e/.chef/client.rb +++ b/kitchen-tests/.chef/client.rb diff --git a/spec/e2e/.kitchen.travis.yml b/kitchen-tests/.kitchen.travis.yml index 7b256fcdb2..6ea825fc12 100644 --- a/spec/e2e/.kitchen.travis.yml +++ b/kitchen-tests/.kitchen.travis.yml @@ -10,6 +10,7 @@ provisioner: github: <%= ENV['TRAVIS_REPO_SLUG'] %> branch: <%= ENV['TRAVIS_COMMIT'] %> require_chef_omnibus: true + data_path: test/fixtures platforms: - name: ubuntu-12.04 @@ -31,7 +32,8 @@ platforms: username: ec2-user suites: - - name: default + - name: webapp run_list: - - recipe[git-cookbook::default] + - recipe[apt::default] + - recipe[webapp::default] attributes: diff --git a/spec/e2e/.kitchen.yml b/kitchen-tests/.kitchen.yml index 0409e3821f..651a606502 100644 --- a/spec/e2e/.kitchen.yml +++ b/kitchen-tests/.kitchen.yml @@ -4,13 +4,15 @@ provisioner: github: "opscode/chef" branch: <%= %x(git rev-parse HEAD) %> require_chef_omnibus: true + data_path: test/fixtures platforms: - name: ubuntu-12.04 driver_plugin: vagrant suites: - - name: default + - name: webapp run_list: - - recipe[git-cookbook::default] + - recipe[apt::default] + - recipe[webapp::default] attributes: diff --git a/kitchen-tests/Berksfile b/kitchen-tests/Berksfile new file mode 100644 index 0000000000..66569ed97f --- /dev/null +++ b/kitchen-tests/Berksfile @@ -0,0 +1,3 @@ +source "https://supermarket.getchef.com" + +cookbook "webapp", :path => "cookbooks/webapp" diff --git a/kitchen-tests/Gemfile b/kitchen-tests/Gemfile new file mode 100644 index 0000000000..60df7ef388 --- /dev/null +++ b/kitchen-tests/Gemfile @@ -0,0 +1,14 @@ +source "https://rubygems.org" + +group :end_to_end do + gem 'berkshelf' + # Once merged into test-kitchen/test-kitchen:master we can remove + # this and replace it with + # gem 'test-kitchen', :github => 'test-kitchen/test-kitchen' + # until the next test-kitchen gem release. + gem 'test-kitchen', :github => 'mcquin/test-kitchen', + :branch => 'mcquin/install_chef_from_github' + + gem 'kitchen-vagrant' # Used for local testing + gem 'kitchen-ec2' # Used for remote (Travis) testing +end diff --git a/kitchen-tests/README.md b/kitchen-tests/README.md new file mode 100644 index 0000000000..2d03b19b62 --- /dev/null +++ b/kitchen-tests/README.md @@ -0,0 +1,89 @@ +# End-To-End Testing for Chef Client +Here we seek to provide end-to-end testing of Chef Client through cookbooks which +exercise many of the available resources, providers, and common patterns. The cookbooks +here are designed to ensure certain capabilities remain functional with updates +to the client code base. + +## Getting started +All the gems needed to run these tests can be installed with Bundler. + +```shell +chef/kitchen-tests$ bundle install +``` + +To ensure everything is working properly, and to see which platforms can have tests +executed on them, run + +```shell +chef/kitchen-tests$ bundle exec kitchen list +``` + +You should see output similar to + +```shell +Instance Driver Provisioner Last Action +webapp-ubuntu-1204 Vagrant ChefSolo <Not Created> +``` + +## Testing +We use Test Kitchen to build instances, test client code, and destroy instances. If +you are unfamiliar with Test Kitchen we recommend checking out the [tutorial](http://kitchen.ci/) +along with the `kitchen-vagrant` [driver documentation](https://github.com/test-kitchen/kitchen-vagrant). +Test Kitchen is configured to manipulate instances using [Vagrant](http://www.vagrantup.com/) +when testing locally, and [Amazon EC2](http://aws.amazon.com/ec2/) when testing +pull requests on [Travis CI](https://travis-ci.com). + +### Commands +Kitchen instances are led through a series of states. The instance states, and the actions +taken to transition into each state, are in order: +* `destroy`: Delete all information for and terminate one or more instances. + * This is equivalent to running `vagrant destroy` to stop and delete a Vagrant machine. +* `create`: Start one or more instances. + * This is equivalent to running `vagrant up --no-provision` to start a Vagrant instance. +* `converge`: Use a provisioner to configure one or more instances. + * By default, Test Kitchen is configured to use the `ChefSolo` provisioner which: + * Prepares local files for transfer, + * Installs the latest release of Chef Omnibus, + * Downloads Chef Client source code from the prescribed GitHub repository and reference, + * Builds and installs a `chef` gem from the downloaded source, + * Runs `chef-client`. +* `setup`: Prepare to run automated tests. Installs `busser` and related gems on one or more instances. +* `verify`: Run automated tests on one or more instances. + +When transitioning between states, actions for any and all intermediate states will performed. +Executing the `create` then the `verify` commands is equivalent to executing `create`, `converge`, +`setup`, and `verify` one-by-one and in order. The only exception is `destroy`, which will +immediately transfer that machine's state to destroyed. + +The `test` command takes one or more instances through all the states, in order: `destroy`, `create`, +`converge`, `setup`, `verify`, `destroy`. + +To see a list of available commands, type `bundle exec kitchen help`. To see more information +about a particular command, type `bundle exec kitchen help <command>`. + +### Configuring your tests +Test Kitchen is configured for local testing in the `.kitchen.yml` file which resides in this directory. +You will need to configure the provisioner before running the tests. + +The provisioner can be configured to pull client source code from a GitHub repository using any +valid Git reference. You are encouraged to modify any of these settings, but please return them +to their original values before submitting a pull request for review (unless, of course, your +changes are enhancements to the default provisioner settings). + +By default, the provisioner is configured to pull your most recent commit to `opscode/chef`. You +can change this by modifying the `github` and `branch` provisioner options: +* `github`: Set this to `"<your_username>/<your_chef_repo>"`. The default is `"opscode/chef"`. +* `branch`: This can be any valid git reference (e.g., branch name, tag, or commit SHA). If omitted, it defaults to `master`. + +The branch you choose must be accessible on GitHub. You cannot use a local commit at this time. + +### Testing pull requests +These end-to-end tests are also configured to run with Travis on EC2 instances when you submit a pull request +to `opscode/chef`. Kitchen is configured to pull chef client source code from the branch it is testing. There +is no need to modify `.kitchen.travis.yml` unless you are contributing tests. + +## Contributing +We would love to fill out our end-to-end testing coverage! If you have cookbooks and tests that you would +like to see become a part of client testing, we encourage you to submit a pull request with your additions. +We request that you do not add platforms to `.kitchen.travis.yml`. Please file a request to add a +platform under [Issues](https://github.com/opscode/chef/issues). diff --git a/kitchen-tests/cookbooks/webapp/Berksfile b/kitchen-tests/cookbooks/webapp/Berksfile new file mode 100644 index 0000000000..4b6079016e --- /dev/null +++ b/kitchen-tests/cookbooks/webapp/Berksfile @@ -0,0 +1,5 @@ +source "https://api.berkshelf.com" + +metadata + +cookbook "apt" diff --git a/spec/e2e/cookbooks/git-cookbook/README.md b/kitchen-tests/cookbooks/webapp/README.md index 4431091bc1..e8de6ee467 100644 --- a/spec/e2e/cookbooks/git-cookbook/README.md +++ b/kitchen-tests/cookbooks/webapp/README.md @@ -1,3 +1,4 @@ -# git-cookbook +# webapp TODO: Enter the cookbook description here. + diff --git a/kitchen-tests/cookbooks/webapp/attributes/default.rb b/kitchen-tests/cookbooks/webapp/attributes/default.rb new file mode 100644 index 0000000000..efe06b6549 --- /dev/null +++ b/kitchen-tests/cookbooks/webapp/attributes/default.rb @@ -0,0 +1,7 @@ +default['apache']['remote_host_ip'] = '127.0.0.1' + +default['mysql']['version'] = "5.5" + +default['webapp']['database'] = 'webapp' +default['webapp']['db_username'] = 'webapp' +default['webapp']['path'] = '/var/www/' diff --git a/kitchen-tests/cookbooks/webapp/metadata.rb b/kitchen-tests/cookbooks/webapp/metadata.rb new file mode 100644 index 0000000000..ecfb419953 --- /dev/null +++ b/kitchen-tests/cookbooks/webapp/metadata.rb @@ -0,0 +1,12 @@ +name 'webapp' +maintainer '' +maintainer_email '' +license '' +description 'Installs/Configures webapp' +long_description 'Installs/Configures webapp' +version '0.1.0' + +depends 'apache2' +depends 'database' +depends 'mysql' +depends 'php' diff --git a/kitchen-tests/cookbooks/webapp/recipes/default.rb b/kitchen-tests/cookbooks/webapp/recipes/default.rb new file mode 100644 index 0000000000..82479e5137 --- /dev/null +++ b/kitchen-tests/cookbooks/webapp/recipes/default.rb @@ -0,0 +1,61 @@ +# +# 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 + +apache_site "default" do + enable true +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/kitchen-tests/cookbooks/webapp/templates/default/index.html.erb b/kitchen-tests/cookbooks/webapp/templates/default/index.html.erb new file mode 100644 index 0000000000..6da0629b9e --- /dev/null +++ b/kitchen-tests/cookbooks/webapp/templates/default/index.html.erb @@ -0,0 +1,5 @@ +<html> + <body> + <h1>Hello, World!</h1> + </body> +</html> diff --git a/kitchen-tests/cookbooks/webapp/templates/default/index.php.erb b/kitchen-tests/cookbooks/webapp/templates/default/index.php.erb new file mode 100644 index 0000000000..b08b076614 --- /dev/null +++ b/kitchen-tests/cookbooks/webapp/templates/default/index.php.erb @@ -0,0 +1,8 @@ +<html> + <head> + <title>PHP Test</title> + </head> + <body> + <?php echo '<p>Hello, World!</p>'; ?> + </body> +</html> diff --git a/kitchen-tests/data_bags/passwords/mysql.json b/kitchen-tests/data_bags/passwords/mysql.json new file mode 100644 index 0000000000..af02a6a858 --- /dev/null +++ b/kitchen-tests/data_bags/passwords/mysql.json @@ -0,0 +1,5 @@ +{ + "id": "mysql", + "server_root_password": "ilikerandompasswordstoo", + "server_repl_password": "itoolikerandompasswords" +} diff --git a/kitchen-tests/data_bags/passwords/webapp.json b/kitchen-tests/data_bags/passwords/webapp.json new file mode 100644 index 0000000000..43c0ae1ced --- /dev/null +++ b/kitchen-tests/data_bags/passwords/webapp.json @@ -0,0 +1,4 @@ +{ + "id": "webapp", + "db_password": "supersecretdbpassword" +} 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 diff --git a/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb b/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb new file mode 100644 index 0000000000..e604de8f7f --- /dev/null +++ b/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb @@ -0,0 +1,127 @@ + +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 "mysql-server-#{property[:mysql][:server][:version]} package" do + include_examples "a package" do + let(:package_name) { "mysql-server-#{property[:mysql][:server][:version]}" } + end + end + + describe "mysql-client package" do + include_examples "a package" do + let(:package_name) { "mysql-client" } + end + end + + describe "php package" do + include_examples "a package" do + let(:package_name) { "php5" } + 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) { "mysql" } + 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)).to return_stdout(/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)).to return_stdout(/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)).to return_stdout(/#{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 diff --git a/spec/e2e/Berksfile b/spec/e2e/Berksfile deleted file mode 100644 index fad6f7f9c0..0000000000 --- a/spec/e2e/Berksfile +++ /dev/null @@ -1,3 +0,0 @@ -source "https://supermarket.getchef.com" - -cookbook 'git-cookbook', :path => 'cookbooks/git-cookbook' diff --git a/spec/e2e/Berksfile.lock b/spec/e2e/Berksfile.lock deleted file mode 100644 index 7e950ed790..0000000000 --- a/spec/e2e/Berksfile.lock +++ /dev/null @@ -1,6 +0,0 @@ -DEPENDENCIES - git-cookbook - path: cookbooks/git-cookbook - -GRAPH - git-cookbook (0.1.0) diff --git a/spec/e2e/Gemfile b/spec/e2e/Gemfile deleted file mode 100644 index 996dc12f66..0000000000 --- a/spec/e2e/Gemfile +++ /dev/null @@ -1,8 +0,0 @@ -source "https://rubygems.org" - -gem 'berkshelf' -gem 'test-kitchen', :github => 'mcquin/test-kitchen', - :branch => 'mcquin/install_chef_from_github' - -gem 'kitchen-vagrant' -gem 'kitchen-ec2' diff --git a/spec/e2e/README.md b/spec/e2e/README.md deleted file mode 100644 index e5b205c1b6..0000000000 --- a/spec/e2e/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# End-To-End Testing for Chef Client - -The goal is to provide end-to-end testing of `chef-client` and tools which ship -with it. To accomplish this, we use Test Kitchen with the `chef-solo` provisioner -to download Chef source code from GitHub, locally create and install the chef -gem from the source code, and run functional tests. Currently, these tests can -be run locally on your machine, or on Travis when you submit a pull request. - -## Testing -### On your local machine -By default, Test Kitchen uses the [kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant) -driver plugin to create local kitchen instances and installs Chef based on your -latest commit to `github.com/opscode/chef`. Currently, for this to work you'll -need to ensure that your latest commit has been pushed to GitHub. If you want to -download Chef from a different commit, modify the `branch` line under -`provisioner` to have that commit's SHA. For example, it may look something like this: - -```(yaml) -# spec/e2e/.kitchen.yml ---- -provisioner: - name: chef_solo - branch: c8a54df7ca24f1482a701d5f39879cdc6c836f8a - github: "github.com/opscode/chef" - require_chef_omnibus: true - -platforms: - - name: ubuntu-12.04 - driver_plugin: vagrant -``` -`branch` accepts any valid git reference. - -When you're ready to test, execute the following lines (this assumes your current -working directory is the head of the chef source code, e.g. mine is`~/oc/chef/`): - -``` -$ pwd -~/oc/chef -$ cd spec/e2e -$ bundle install -$ bundle exec kitchen test -``` -To change what Test Kitchen runs, modify your `spec/e2e/.kitchen.yml`. - -### On Travis -By default, Test Kitchen uses the [kitchen-ec2](https://github.com/test-kitchen/kitchen-ec2) -driver plugin to create kitchen instances on EC2 and installs Chef based on the -latest pushed commit to your pull request on `github.com/opscode/chef`. That is, -Travis installs Chef from the branch and commit it's testing. Travis runs automatically -every time you publish your commits to a pull request, so please disable Test Kitchen -in Travis (by commenting out the appropriate lines in your `.travis.yml`) or push -new commits to your PR infrequently. - -To change what Test Kitchen runs, modify your `spec/e2e/.kitchen.travis.yml`. - -**IMPORTANT: Do not modify any of the values in the matrix under `env`!** These are carefully -configured so that Travis can use EC2 and Test Kitchen. diff --git a/spec/e2e/cookbooks/git-cookbook/metadata.rb b/spec/e2e/cookbooks/git-cookbook/metadata.rb deleted file mode 100644 index 9c2e5b8c7c..0000000000 --- a/spec/e2e/cookbooks/git-cookbook/metadata.rb +++ /dev/null @@ -1,7 +0,0 @@ -name 'git-cookbook' -maintainer '' -maintainer_email '' -license '' -description 'Installs/Configures example' -long_description 'Installs/Configures example' -version '0.1.0' diff --git a/spec/e2e/cookbooks/git-cookbook/recipes/default.rb b/spec/e2e/cookbooks/git-cookbook/recipes/default.rb deleted file mode 100644 index 1203f7465e..0000000000 --- a/spec/e2e/cookbooks/git-cookbook/recipes/default.rb +++ /dev/null @@ -1,9 +0,0 @@ -# -# Cookbook Name:: git-cookbook -# Recipe:: default -# -# Copyright (C) 2014 -# -# - -package 'git' diff --git a/spec/e2e/cookbooks/git-cookbook/test/integration/default/rspec/spec_helper.rb b/spec/e2e/cookbooks/git-cookbook/test/integration/default/rspec/spec_helper.rb deleted file mode 100644 index e69de29bb2..0000000000 --- a/spec/e2e/cookbooks/git-cookbook/test/integration/default/rspec/spec_helper.rb +++ /dev/null diff --git a/spec/e2e/cookbooks/git-cookbook/test/integration/default/rspec/unit/git_installed_spec.rb b/spec/e2e/cookbooks/git-cookbook/test/integration/default/rspec/unit/git_installed_spec.rb deleted file mode 100644 index 3a2c3f971c..0000000000 --- a/spec/e2e/cookbooks/git-cookbook/test/integration/default/rspec/unit/git_installed_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ - -require 'spec_helper' - -require 'chef/mixin/shell_out' - -describe "git-cookbook cookbook" do - include Chef::Mixin::ShellOut - - it "should install git" do - so = shell_out('which git') - so.exitstatus.should == 0 - end -end |