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

Commit

Permalink
spec: Added support for kitchen testing to travis
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Oct 22, 2016
1 parent 8e93248 commit 86a6544
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 532 deletions.
4 changes: 4 additions & 0 deletions .kitchen.docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
driver:
name: docker
privileged: true
3 changes: 0 additions & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ suites:
- recipe[opsworks_ruby::deploy]
# no attributes at all, to prove that cookbook can work "out of the box"
attributes:
driver:
synced_folders:
- ["test/integration/repos", "/opt/repositories"]
22 changes: 15 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
sudo: false
sudo: required
services: docker

rvm:
- 'ruby-2.3.1'

addons:
apt:
sources:
Expand All @@ -10,18 +13,23 @@ addons:
- chefdk
- python-pip

env:
matrix:
- INSTANCE=default-ubuntu-1404

before_install: "gem install bundler"
install:
- pip install --user yamllint
- bundle install --without chef
- chef exec bundle install --jobs=5 --retry=5

before_script:
- chef gem install coveralls
- sudo iptables -L DOCKER || sudo iptables -N DOCKER
- git config --global user.email "travis@travis.ci"
- git config --global user.name "Travis CI"
- bundle exec overcommit --sign
- bundle exec overcommit --sign pre-commit
- chef exec bundle exec overcommit --sign
- chef exec bundle exec overcommit --sign pre-commit

script:
- bundle exec overcommit -r
- chef exec rspec
- chef exec bundle exec overcommit -r
- chef exec bundle exec rspec
- travis_retry chef exec bundle exec rake integration:docker[${INSTANCE}]
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ group :chef do
gem 'berkshelf'
gem 'chefspec'
gem 'kitchen-vagrant'
gem 'kitchen-docker'
gem 'rspec'
gem 'test-kitchen'
end
5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ GEM
iniparse (1.4.2)
ipaddress (0.8.3)
json (2.0.2)
kitchen-docker (2.6.0)
test-kitchen (>= 1.0.0)
kitchen-vagrant (0.20.0)
test-kitchen (~> 1.4)
kramdown (1.12.0)
Expand Down Expand Up @@ -339,6 +341,7 @@ DEPENDENCIES
coveralls
fasterer
foodcritic
kitchen-docker
kitchen-vagrant
mdl
overcommit
Expand All @@ -348,4 +351,4 @@ DEPENDENCIES
travis

BUNDLED WITH
1.12.5
1.13.5
25 changes: 25 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# frozen_string_literal: true
require 'bundler/setup'

desc 'Run Test Kitchen integration tests'
namespace :integration do
desc 'Run integration tests with kitchen-vagrant'
task :vagrant do
require 'kitchen'
Kitchen.logger = Kitchen.default_file_logger
Kitchen::Config.new.instances.each { |instance| instance.test(:always) }
end

desc 'Run integration tests with kitchen-docker'
task :docker, [:instance] do |_t, args|
args.with_defaults(instance: 'default-ubuntu-1404')
require 'kitchen'
Kitchen.logger = Kitchen.default_file_logger
loader = Kitchen::Loader::YAML.new(local_config: '.kitchen.docker.yml')
instances = Kitchen::Config.new(loader: loader).instances
# Travis CI Docker service does not support destroy:
instances.get(args.instance).verify
end
end

task default: %w(integration:vagrant)
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def dummy_context(node)
end

# Require all libraries
Dir['libraries/*.rb'].each { |f| require File.expand_path(f) }
require File.expand_path('../../libraries/all.rb', __FILE__)

# Require all fixtures
Dir[File.expand_path('../fixtures/*.rb', __FILE__)].each { |f| require f }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"app_source": {
"password": "3aa161d358a167204502",
"revision": "master",
"ssh_key": "--- SSH KEY ---",
"ssh_key_comment": "Don't get cocky, this is a dummy key only for this purpose",
"ssh_key": "-----BEGIN RSA PRIVAT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tGlWPhwI8XjIQveDQ+Oh1rpyvycHDp62l8CgYEAn4L4EDwddNxRF5KX6dHZ\nLYFfOvhylTcSPsN+Y/GhmNWpDu3R04MEq4UwlUT9V1MyejWS4Y5PxRSd9zpY4vHv\nRtpGaDT+JdMWxWN/2y1HkL5uJnEZxAkmFSXUFdCqmKnhTlCHdjOB8qq62mN/W0Lw\n+5RRxWjZ7JzbaktgX4DPD90CgYAiJkDRhECqaNg8V2FKND2gvmGpqHOMVPwwa/9J\n5Cfath/lwu6Le3WzdAfbX+6941G87I0GoMohLhqEtOv7lw+cNZzHF8YC6Tc0u4f6\npH14ttCqDqzAaXC3tysi7WtrmcMRksRKY6E3AJNhROQOWg+A53ZVdZ2lcZEDJ9Dw\nwkFLNwKBgAiVUf4INOpW+6XcmXnaVbj2iCuIjEgnFa222U5I6XLxYFi8KvxojipU\n/k06kephV723a3AKx9Hj2Dq1LHkmyHVG7WJtP14jv4d6VIScKePYrB07NoQaq/HL\n+PK1ghQJ4ZOk+L4H0qBmLtzRFotSQJlsGuw8qY6M0ieiauiCu+AD\n-----END RSA PRIVATE KEY-----\n",
"type": "git",
"url": "/opt/repositories/dummy-app.git",
"url": "git@github.com:ajgon/dummy-app.git",
"user": "dummy"
},
"attributes": {
Expand Down
1 change: 0 additions & 1 deletion test/integration/repos/dummy-app.git/HEAD

This file was deleted.

8 changes: 0 additions & 8 deletions test/integration/repos/dummy-app.git/config

This file was deleted.

1 change: 0 additions & 1 deletion test/integration/repos/dummy-app.git/description

This file was deleted.

15 changes: 0 additions & 15 deletions test/integration/repos/dummy-app.git/hooks/applypatch-msg.sample

This file was deleted.

24 changes: 0 additions & 24 deletions test/integration/repos/dummy-app.git/hooks/commit-msg.sample

This file was deleted.

8 changes: 0 additions & 8 deletions test/integration/repos/dummy-app.git/hooks/post-update.sample

This file was deleted.

14 changes: 0 additions & 14 deletions test/integration/repos/dummy-app.git/hooks/pre-applypatch.sample

This file was deleted.

49 changes: 0 additions & 49 deletions test/integration/repos/dummy-app.git/hooks/pre-commit.sample

This file was deleted.

53 changes: 0 additions & 53 deletions test/integration/repos/dummy-app.git/hooks/pre-push.sample

This file was deleted.

Loading

0 comments on commit 86a6544

Please sign in to comment.