summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-04-22 10:34:43 -0700
committerBryan McLellan <btm@loftninjas.org>2019-05-17 11:11:41 -0400
commit1a0b678b93cdb88227254207830c559605d90a3a (patch)
tree6a1f8914fab854db633a617f987a43cc445c9cbb
parent8638b760d887e6475f6412ec6010910445707126 (diff)
downloadchef-1a0b678b93cdb88227254207830c559605d90a3a.tar.gz
Merge the local and travis kitchen tests into a single config
Make sure people are doing their local testing the same way it will run in Travis. The local testing didn't actually work before so this is a pretty solid win. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--.travis.yml38
-rw-r--r--kitchen-tests/README.md18
-rw-r--r--kitchen-tests/kitchen.yml128
3 files changed, 129 insertions, 55 deletions
diff --git a/.travis.yml b/.travis.yml
index 84e7159134..898bab86c2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -154,7 +154,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- AMAZON=2
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -171,7 +171,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- AMAZON=201X
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -187,8 +187,8 @@ matrix:
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- - UBUNTU=14.04
- - KITCHEN_YAML=kitchen.travis.yml
+ - UBUNTU=16.04
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -204,8 +204,8 @@ matrix:
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- - UBUNTU=16.04
- - KITCHEN_YAML=kitchen.travis.yml
+ - UBUNTU=18.04
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -221,8 +221,8 @@ matrix:
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- - UBUNTU=18.04
- - KITCHEN_YAML=kitchen.travis.yml
+ - DEBIAN=8
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -238,8 +238,8 @@ matrix:
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- - DEBIAN=8
- - KITCHEN_YAML=kitchen.travis.yml
+ - DEBIAN=9
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -255,8 +255,8 @@ matrix:
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- - DEBIAN=9
- - KITCHEN_YAML=kitchen.travis.yml
+ - DEBIAN=10
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -273,7 +273,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- CENTOS=6
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -290,7 +290,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- CENTOS=7
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -307,7 +307,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- FEDORA=latest
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -324,7 +324,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- OPENSUSELEAP=42
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
sudo: required
before_install:
@@ -362,7 +362,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- RSPEC_CENTOS=7
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
- rvm: 2.5.5
services: docker
sudo: required
@@ -379,7 +379,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- RSPEC_OPENSUSELEAP=42
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
allow_failures:
- rvm: 2.5.5
services: docker
@@ -397,7 +397,7 @@ matrix:
- cat .kitchen/logs/kitchen.log
env:
- RSPEC_OPENSUSELEAP=42
- - KITCHEN_YAML=kitchen.travis.yml
+ - KITCHEN_YAML=kitchen.yml
- env:
TEST_GEM: poise/halite
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake spec
diff --git a/kitchen-tests/README.md b/kitchen-tests/README.md
index 95234ca383..9bf20a8fab 100644
--- a/kitchen-tests/README.md
+++ b/kitchen-tests/README.md
@@ -4,7 +4,7 @@ Here we seek to provide end-to-end testing of Chef Client through cookbooks whic
## Getting started
-All the gems needed to run these tests can be installed with Bundler.
+These tests run in Docker containers so make sure to install Docker on your workstation. Once docker is installed all the gems needed to run these tests can be installed with Bundler.
```shell
chef/kitchen-tests$ bundle install
@@ -19,21 +19,21 @@ chef/kitchen-tests$ bundle exec kitchen list
You should see output similar to
```shell
-Instance Driver Provisioner Verifier Transport Last Action Last Error
-end-to-end-amazonlinux Vagrant ChefGithub Inspec Ssh <Not Created> <None>
+Instance Driver Provisioner Verifier Transport Last Action Last Error
+end-to-end-amazonlinux Dokken Dokken Inspec Dokken <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](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/).
+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-dokken` [driver documentation](https://github.com/someara/kitchen-dokken). Test Kitchen is configured to manipulate instances using [Docker](https://www.docker.com/) when testing locally and 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.
+- `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.
+- `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:
@@ -53,7 +53,7 @@ To see a list of available commands, type `bundle exec kitchen help`. To see mor
### 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.
+Test Kitchen is configured 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).
@@ -66,8 +66,8 @@ The branch you choose must be accessible on GitHub. You cannot use a local commi
### Testing pull requests
-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.
+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.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/chef/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.yml`. Please file a request to add a platform under [Issues](https://github.com/chef/chef/issues).
diff --git a/kitchen-tests/kitchen.yml b/kitchen-tests/kitchen.yml
index 0c49201927..5723e13ffd 100644
--- a/kitchen-tests/kitchen.yml
+++ b/kitchen-tests/kitchen.yml
@@ -1,41 +1,115 @@
---
driver:
- name: vagrant
- customize:
- cpus: 4
- memory: 2048
+ name: dokken
+ privileged: true
+ chef_image: chef/chef
+ chef_version: current
-verifier:
- name: inspec
- format: progress
+transport:
+ name: dokken
provisioner:
- name: chef_github
- chef_omnibus_url: "https://omnitruck.chef.io/install.sh"
- chef_omnibus_install_options: "-c current -v 14"
- github_owner: "chef"
- github_repo: "chef"
- ohai_refname: "master"
- refname: <%= %x(git rev-parse HEAD) %>
- chef_license: "accept-no-persist"
+ name: dokken
client_rb:
diff_disabled: true
+lifecycle:
+ pre_converge:
+ - remote: /opt/chef/embedded/bin/gem install appbundle-updater
+ - remote: /opt/chef/embedded/bin/appbundle-updater chef ohai <%= File.readlines('../Gemfile.lock', File.expand_path(File.dirname(__FILE__))).find { |l| l =~ /^\s+ohai \((\d+\.\d+\.\d+)\)/ }; 'v' + $1 %> --tarball --github chef/ohai
+ - remote: /opt/chef/embedded/bin/appbundle-updater chef chef <%= ENV['TRAVIS_COMMIT'] %> --tarball --github chef/chef
+
+verifier:
+ name: inspec
+ format: progress
+
platforms:
- - name: amazonlinux
- driver_config:
- box: mvbcoding/awslinux
- - name: centos-6
- - name: centos-7
- - name: debian-8
- - name: debian-9
- - name: opensuse-leap-42
- - name: ubuntu-14.04
- - name: ubuntu-16.04
- - name: ubuntu-18.04
+- name: amazonlinux
+ driver:
+ image: dokken/amazonlinux
+ pid_one_command: /sbin/init
+ intermediate_instructions:
+ - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
+
+- name: amazonlinux-2
+ driver:
+ image: dokken/amazonlinux-2
+ pid_one_command: /usr/lib/systemd/systemd
+ intermediate_instructions:
+ - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
+
+- name: debian-8
+ driver:
+ image: dokken/debian-8
+ pid_one_command: /bin/systemd
+ intermediate_instructions:
+ - RUN /usr/bin/apt-get update
+
+- name: debian-9
+ driver:
+ image: dokken/debian-9
+ pid_one_command: /bin/systemd
+ intermediate_instructions:
+ - RUN /usr/bin/apt-get update
+
+- name: debian-10
+ driver:
+ image: dokken/debian-10
+ pid_one_command: /bin/systemd
+ intermediate_instructions:
+ - RUN /usr/bin/apt-get update
+
+- name: centos-6
+ driver:
+ image: dokken/centos-6
+ pid_one_command: /sbin/init
+ intermediate_instructions:
+ - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
+
+- name: centos-7
+ driver:
+ image: dokken/centos-7
+ pid_one_command: /usr/lib/systemd/systemd
+ intermediate_instructions:
+ - RUN yum -y install e2fsprogs
+ - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
+
+- name: fedora-latest
+ driver:
+ image: dokken/fedora-latest
+ pid_one_command: /usr/lib/systemd/systemd
+ intermediate_instructions:
+ - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
+
+- name: ubuntu-16.04
+ driver:
+ image: dokken/ubuntu-16.04
+ pid_one_command: /bin/systemd
+ intermediate_instructions:
+ - RUN /usr/bin/apt-get update
+
+- name: ubuntu-18.04
+ driver:
+ image: dokken/ubuntu-18.04
+ pid_one_command: /bin/systemd
+ intermediate_instructions:
+ - RUN /usr/bin/apt-get update
+
+- name: opensuse-leap
+ driver:
+ image: dokken/opensuse-leap
+ pid_one_command: /bin/systemd
+ intermediate_instructions:
+ - RUN /usr/bin/zypper --non-interactive update
+ - RUN /usr/bin/zypper --non-interactive install cron
suites:
- name: end-to-end
run_list:
- recipe[end_to_end::default]
- - recipe[end_to_end::tests]
+ - name: rspec
+ run_list:
+ - recipe[rspec]
+ lifecycle:
+ post_converge:
+ - remote: /usr/local/bin/run-chef-rspec