Skip to content

Commit

Permalink
Merge pull request #7377 from chef/kitchen_cleanup
Browse files Browse the repository at this point in the history
Remove awesome customers testing and update kitchen configs
  • Loading branch information
tas50 authored Jun 16, 2018
2 parents aa4f328 + 5d05a0f commit 91a5601
Show file tree
Hide file tree
Showing 18 changed files with 105 additions and 245 deletions.
57 changes: 11 additions & 46 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- AMAZON=2
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -149,7 +149,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- AMAZON=201X
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -166,7 +166,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- UBUNTU=14.04
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -183,7 +183,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- UBUNTU=16.04
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -200,7 +200,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- UBUNTU=18.04
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -217,7 +217,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- DEBIAN=8
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -234,7 +234,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- DEBIAN=9
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -251,7 +251,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- CENTOS=6
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -268,7 +268,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- CENTOS=7
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -285,7 +285,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- FEDORA=latest
- KITCHEN_YAML=.kitchen.travis.yml
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.4.4
services: docker
sudo: required
Expand All @@ -302,42 +302,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- OPENSUSELEAP=42
- KITCHEN_YAML=.kitchen.travis.yml
# - rvm: 2.4.4
# services: docker
# sudo: required
# gemfile: kitchen-tests/Gemfile
# before_install:
# - gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
# - gem install bundler -v $(grep :bundler omnibus_overrides.rb | cut -d'"' -f2)
# before_script:
# - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
# - cd kitchen-tests
# script:
# - bundle exec kitchen test awesome-customers-ubuntu-ubuntu-1404
# after_failure:
# - cat .kitchen/logs/kitchen.log
# env:
# - AWESOME_CUSTOMERS_UBUNTU=1
# - KITCHEN_YAML=.kitchen.travis.yml
# - rvm: 2.4.4
# services: docker
# sudo: required
# gemfile: kitchen-tests/Gemfile
# before_install:
# - gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
# - gem install bundler -v $(grep :bundler omnibus_overrides.rb | cut -d'"' -f2)
# before_script:
# - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
# - cd kitchen-tests
# script:
# - bundle exec kitchen test awesome-customers-rhel-centos-7
# after_failure:
# - cat .kitchen/logs/kitchen.log
# env:
# - AWESOME_CUSTOMERS_RHEL=1
# - KITCHEN_YAML=.kitchen.travis.yml
# ### END TEST KITCHEN ONLY ###
- KITCHEN_YAML=kitchen.travis.yml
- rvm: 2.5.1
sudo: required
before_install:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ bin/*
.bundle/*

.kitchen/
.kitchen.local.yml
kitchen.local.yml
6 changes: 0 additions & 6 deletions kitchen-tests/Berksfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
source "https://supermarket.chef.io"

cookbook "base", path: "cookbooks/base"

# Disabled pending updating these test cases for Chef 13.
# cookbook "awesome_customers_ubuntu_wrapper", path: "cookbooks/awesome_customers_ubuntu_wrapper"
# cookbook "awesome_customers_ubuntu", github: "lamont-granquist/awesome_customers_ubuntu", branch: "lcg/bump-mysql-version"
# cookbook "awesome_customers_rhel_wrapper", path: "cookbooks/awesome_customers_rhel_wrapper"
# cookbook "awesome_customers_rhel", github: "lamont-granquist/awesome_customers_rhel", branch: "lcg/bump-mysql-version"
3 changes: 1 addition & 2 deletions kitchen-tests/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ source "https://rubygems.org"

gem "rake" # required to build some native extensions
gem "chef", path: ".."
# remove this ohai pin once we ship the 14 gem
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "master"
gem "ohai", git: "https://github.com/chef/ohai.git", branch: "master" # avoids failures when we bump chef major
gem "berkshelf", git: "https://github.com/berkshelf/berkshelf.git", branch: "master"
gem "kitchen-appbundle-updater", git: "https://github.com/chef/kitchen-appbundle-updater", branch: "master"
gem "kitchen-dokken", "< 2.0" # 2.x fails atm: https://travis-ci.org/chef/chef/jobs/199125787
Expand Down
98 changes: 41 additions & 57 deletions kitchen-tests/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# 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.

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
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
Expand All @@ -21,69 +19,55 @@ 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>
Instance Driver Provisioner Verifier Transport Last Action Last Error
base-amazonlinux Vagrant ChefGithub Inspec Ssh <Not Created> <None>
```

## 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).

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](https://www.vagrantup.com/) when testing locally, and Docker via [kitchen-dokken](https://github.com/someara/kitchen-dokken/) 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>`.

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 the instance to run automated tests.
- `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).
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`.
By default, the provisioner is configured to pull your most recent commit to `chef/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 `"chef/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.

These end-to-end tests are also configured to run on Travis-CI with docker containers when you submit a pull request to `chef/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).

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/chef/chef/issues).

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions kitchen-tests/data_bags/passwords/mysql.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,3 @@ suites:
- name: base
run_list:
- recipe[base::default]
- name: awesome_customers_ubuntu
includes: [ubuntu-14.04, ubuntu-16.04, ubuntu-18.04]
run_list:
- recipe[awesome_customers_ubuntu_wrapper::default]
- name: awesome_customers_rhel
includes: [centos-6, centos-7]
run_list:
- recipe[awesome_customers_rhel_wrapper::default]
9 changes: 1 addition & 8 deletions kitchen-tests/.kitchen.yml → kitchen-tests/kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,9 @@ platforms:
- name: opensuse-leap-42
- name: ubuntu-14.04
- name: ubuntu-16.04
- name: ubuntu-18.04

suites:
- name: base
run_list:
- recipe[base::default]
- name: awesome_customers_ubuntu
includes: [ubuntu-14.04, ubuntu-16.04]
run_list:
- recipe[awesome_customers_ubuntu_wrapper::default]
- name: awesome_customers_rhel
includes: [centos-6, centos-7]
run_list:
- recipe[awesome_customers_rhel_wrapper::default]
2 changes: 1 addition & 1 deletion omnibus/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vendor/bundle
pkg/*
.kitchen.local.yml
kitchen.local.yml
bin/*
files/chef-server-cookbooks/cache/
files/msi/ChefClient-Config.wxi
Expand Down
2 changes: 1 addition & 1 deletion omnibus/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ group :development do
gem "ohai", "~> 13.0"

# Use Test Kitchen with Vagrant for converging the build environment
gem "test-kitchen", "~> 1.13"
gem "test-kitchen", "~> 1.21"
gem "kitchen-vagrant", "~> 1.3.1"
gem "winrm-fs", "~> 1.0"
gem "pry"
Expand Down
Loading

0 comments on commit 91a5601

Please sign in to comment.