Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.

Commit

Permalink
add rake task for integration testing
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Münch <[email protected]>
  • Loading branch information
atomic111 committed Jul 28, 2016
1 parent 34144cf commit 0e455c0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 20 deletions.
4 changes: 1 addition & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
---
driver:
name: docker
privileged: true
use_sudo: false
provision_command:
- "mkdir /var/run/sshd"

transport:
max_ssh_sessions: 5

provisioner:
name: ansible_playbook
hosts: all
Expand Down
46 changes: 29 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
---
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
language: python
python: "2.7"
sudo: required
language: ruby
cache: bundler
dist: trusty

env:
- ANSIBLE_VERSION=latest
- ANSIBLE_VERSION=1.9.4
services:
- docker

before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python-apt python-pycurl
install:
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi
- echo -e 'localhost ansible_connection=local' > spec/inventory
- echo -e '[defaults]\nroles_path = ../\nhostfile = ./spec/inventory' > ansible.cfg
- gem --version
- bundle version

script:
- ansible-playbook --syntax-check spec/travis.yml
- ansible-playbook --sudo -v --diff spec/travis.yml
- ansible-playbook --sudo -v --diff spec/travis.yml --extra-vars "network_ipv6_enable=true ssh_allow_root_with_key=true ssh_client_password_login=true ssh_client_cbc_required=true ssh_server_weak_hmac=true ssh_client_weak_kex=true sftp_enabled=true"
# https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142455888
before_script: sudo iptables -L DOCKER || sudo iptables -N DOCKER


script: travis_retry bundle exec kitchen test

#matrix:
# include:
# # verify lint and unit
# # - rvm: 2.3.1
# # gemfile: Gemfile
# # bundler_args: "--without integration guard tools"
# # integration tests
# - rvm: 2.3.1
# bundler_args: "--without guard tools"
# script: bundle exec rake integration OS='centos oracle'
# gemfile: Gemfile
# - rvm: 2.3.1
# bundler_args: "--without guard tools"
# script: bundle exec rake integration OS='ubuntu debian'
#gemfile: Gemfile
14 changes: 14 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/env rake
# encoding: utf-8

require 'foodcritic'
require 'rspec/core/rake_task'

# Rubocop before rspec so we don't lint vendored cookbooks
desc 'Run all tests except Kitchen (default task)'
task default: [:integration]

# Automatically generate a changelog for this project. Only loaded if
# the necessary gem is installed.
begin
Expand All @@ -9,3 +16,10 @@ begin
rescue LoadError
puts '>>>>> GitHub Changelog Generator not loaded, omitting tasks'
end

desc 'Run integration tests'
task :integration do
concurrency = ENV['CONCURRENCY'] || 1
os = ENV['OS'] || ''
sh('sh', '-c', "bundle exec kitchen test -c #{concurrency} #{os}")
end

0 comments on commit 0e455c0

Please sign in to comment.