Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve tests: migrate to inspec #438

Merged
merged 16 commits into from
Apr 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .kitchen.cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ suites:
- name: default
run_list:
- recipe[rabbitmq::default]

- name: default-use-distro-version
run_list:
- recipe[rabbitmq::default]
Expand Down
48 changes: 13 additions & 35 deletions .kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ driver:
privileged: true # because Docker and SystemD/Upstart
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup

transport:
name: dokken

Expand All @@ -21,69 +21,47 @@ platforms:
image: centos:6
platform: rhel
pid_one_command: /sbin/init
hostname: localhost
intermediate_instructions:
- RUN yum -y install which initscripts

- name: centos-7.2
driver:
image: centos:7
platform: rhel
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN yum -y install lsof which systemd-sysv initscripts openssl
- RUN yum -y install lsof which systemd-sysv initscripts openssl net-tools

- name: ubuntu-14.04
driver:
image: ubuntu-upstart:14.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN apt-get update

- name: ubuntu-16.04
driver:
image: ubuntu:16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get -y install lsb-release procps net-tools

- name: debian-7
driver:
image: debian:7
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install lsb-release procps -y
- RUN /usr/bin/apt-get -y install lsb-release procps net-tools

- name: debian-8
driver:
image: debian:8
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install lsb-release procps -y

- RUN /usr/bin/apt-get -y install lsb-release procps net-tools

suites:
- name: default
run_list:
- recipe[rabbitmq::default]
- name: default-use-distro-version
run_list:
- recipe[rabbitmq::default]
attributes:
rabbitmq:
use_distro_version: true
excludes: ["centos-6.7", "centos-7.2"]
- name: default-force-yes
run_list:
- recipe[rabbitmq::default]
attributes:
apt:
confd:
assume_yes: true
force-yes: true
excludes: ["centos-6.7", "centos-7.2"]
- name: default-force-yes-false
run_list:
- recipe[rabbitmq::default]
attributes:
apt:
confd:
assume_yes: false
force-yes: false
excludes: ["centos-6.7", "centos-7.2"]
# use (inherit) suites defined in main .kitchen.yml
50 changes: 41 additions & 9 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
driver:
name: vagrant

verifier:
name: inspec

provisioner:
name: chef_zero
require_chef_omnibus: latest
Expand All @@ -16,31 +19,60 @@ suites:
- name: default
run_list:
- recipe[rabbitmq::default]
verifier:
inspec_tests:
- test/smoke/default

- name: default-use-distro-version
run_list:
- recipe[rabbitmq::default]
attributes:
rabbitmq:
use_distro_version: true
verifier:
inspec_tests:
- test/smoke/default
excludes: ["centos-6.7", "centos-7.2"]

- name: lwrps
run_list:
- recipe[rabbitmq_test::lwrps]
verifier:
inspec_tests:
- test/smoke/default
- test/smoke/lwrps
excludes: ["debian-7"]

- name: cluster
run_list:
- recipe[rabbitmq_test::cluster]
verifier:
inspec_tests:
- test/smoke/default
- test/smoke/cluster

- name: default-force-yes
run_list:
- recipe[rabbitmq::default]
attributes:
apt:
confd:
assume_yes: true
force-yes: true
apt:
confd:
assume_yes: true
force-yes: true
verifier:
inspec_tests:
- test/smoke/default
excludes: ["centos-6.7", "centos-7.2"]

- name: default-force-yes-false
run_list:
- recipe[rabbitmq::default]
attributes:
apt:
confd:
assume_yes: false
force-yes: false
excludes: ["centos-6.7", "centos-7.2"]
apt:
confd:
assume_yes: false
force-yes: false
verifier:
inspec_tests:
- test/smoke/default
excludes: ["centos-6.7", "centos-7.2"]
43 changes: 36 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,43 @@ install: echo "skip bundle install"

services: docker

# kitchen list -b | xargs -I {} echo "- INSTANCE={}"
env:
matrix:
- INSTANCE=centos-6
- INSTANCE=centos-7
- INSTANCE=debian-7
- INSTANCE=debian-8
- INSTANCE=ubuntu-1404
- INSTANCE=ubuntu-1604
- INSTANCE=default-centos-67
- INSTANCE=default-centos-72
- INSTANCE=default-ubuntu-1404
- INSTANCE=default-ubuntu-1604
- INSTANCE=default-debian-7
- INSTANCE=default-debian-8

- INSTANCE=default-use-distro-version-ubuntu-1404
- INSTANCE=default-use-distro-version-ubuntu-1604
- INSTANCE=default-use-distro-version-debian-7
- INSTANCE=default-use-distro-version-debian-8

- INSTANCE=lwrps-centos-67
- INSTANCE=lwrps-centos-72
- INSTANCE=lwrps-ubuntu-1404
- INSTANCE=lwrps-ubuntu-1604
- INSTANCE=lwrps-debian-8

- INSTANCE=cluster-centos-67
- INSTANCE=cluster-centos-72
- INSTANCE=cluster-ubuntu-1404
- INSTANCE=cluster-ubuntu-1604
- INSTANCE=cluster-debian-7
- INSTANCE=cluster-debian-8

- INSTANCE=default-force-yes-ubuntu-1404
- INSTANCE=default-force-yes-ubuntu-1604
- INSTANCE=default-force-yes-debian-7
- INSTANCE=default-force-yes-debian-8

- INSTANCE=default-force-yes-false-ubuntu-1404
- INSTANCE=default-force-yes-false-ubuntu-1604
- INSTANCE=default-force-yes-false-debian-7
- INSTANCE=default-force-yes-false-debian-8

before_script:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
Expand All @@ -30,7 +59,7 @@ before_script:
- /opt/chefdk/embedded/bin/cookstyle --version
- /opt/chefdk/embedded/bin/foodcritic --version

script: KITCHEN_LOCAL_YAML=.kitchen.dokken.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
script: KITCHEN_LOCAL_YAML=.kitchen.dokken.yml /opt/chefdk/embedded/bin/kitchen test ${INSTANCE}

matrix:
include:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ to them.

This cookbook is set up to run tests under
[Kitchen-ci's test-kitchen](https://github.com/test-kitchen/test-kitchen).
It uses Serverspec or Bats to perform integration tests after the node
It uses [inspec](http://inspec.io) to perform integration tests after the node
has been converged.

Test kitchen should run completely without exception using the default
Expand Down
18 changes: 9 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
source 'https://rubygems.org'

gem 'chef'
gem 'chefspec'
gem 'berkshelf'
gem 'github_changelog_generator'
gem 'kitchen-digitalocean'
gem 'stove'
gem 'kitchen-dokken'

group :lint do
gem 'foodcritic'
gem 'rubocop'
gem 'rainbow'
gem 'cookstyle'
end

group :unit do
gem 'berkshelf'
gem 'fauxhai'
gem 'chefspec'
end

group :integration do
gem 'inspec'
end

group :kitchen_common do
Expand All @@ -28,13 +27,14 @@ group :kitchen_vagrant do
gem 'kitchen-vagrant'
end

group :kitchen_docker do
gem 'kitchen-docker'
group :kitchen_dokken do
gem 'kitchen-dokken'
end

group :kitchen_cloud do
gem 'kitchen-ec2'
gem 'kitchen-openstack'
gem 'kitchen-digitalocean'
end

group :development do
Expand Down
Loading