Skip to content

Commit

Permalink
Merge pull request #41 from richardc/test_kitchen
Browse files Browse the repository at this point in the history
Convert acceptance tests to use test-kitchen
  • Loading branch information
richardc authored Jun 21, 2017
2 parents 93b88b7 + cf6733e commit 5cce8f2
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 100 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Gemfile.lock
/.rspec_system
/.ruby-version
/.bundle
/.kitchen
21 changes: 21 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
driver:
name: docker
use_sudo: false

provisioner:
name: puppet_apply
require_chef_for_busser: false
require_puppet_collections: true
modules_path: .

verifier:
name: inspec

platforms:
- name: centos-6.9

suites:
- name: default
provisioner:
manifests_path: test/integration/default
30 changes: 17 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
sudo: false
language: ruby
bundler_args: --without development
before_install:
- gem update bundler
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
rvm:
- 1.8.7
- 1.9.3
env:
- PUPPET_GEM_VERSION="~> 3.0.0"
- PUPPET_GEM_VERSION="~> 3.1.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.3.0"
- PUPPET_GEM_VERSION="~> 3.4.0"
- PUPPET_GEM_VERSION="~> 3.5.0"
- PUPPET_GEM_VERSION="~> 3.6.0"
- PUPPET_GEM_VERSION="~> 3.7.0"
matrix:
fast_finish: true
include:
- rvm: 2.3.1
script: bundle exec kitchen test
services: docker
sudo: required
- rvm: 1.9.3
bundler_args: --without integration
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.3.1
bundler_args: --without integration
env: PUPPET_GEM_VERSION="~> 4.0"
notifications:
email: false
11 changes: 5 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ group :development, :test do
gem 'puppet-lint'
end

group :development do
gem 'pry'
gem 'pry-debugger'
gem 'rb-readline'
gem 'awesome_print'
gem 'rspec-system-puppet', '~>2.0'
group :integration do
gem 'test-kitchen'
gem 'kitchen-docker'
gem 'kitchen-inspec'
gem 'kitchen-puppet'
end

# json/json_pure are transitive dependences of puppet.
Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Bundler.require :default
require 'rspec/core/rake_task'
require 'puppetlabs_spec_helper/rake_tasks'

begin
require 'kitchen/rake_tasks'
rescue LoadError
end

task :default do
sh %{rake -T}
end
23 changes: 0 additions & 23 deletions spec/spec_helper_system.rb

This file was deleted.

58 changes: 0 additions & 58 deletions spec/system/basic_spec.rb

This file was deleted.

13 changes: 13 additions & 0 deletions test/integration/default/site.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
datacat { "/tmp/demo1":
template_body => "<% @data.keys.sort.each do |k| %><%= k %>: <%= @data[k] %>, <% end %>",
}

datacat_fragment { "foo":
target => '/tmp/demo1',
data => { foo => "one" },
}

datacat_fragment { "bar":
target => '/tmp/demo1',
data => { bar => "two" },
}
4 changes: 4 additions & 0 deletions test/integration/default/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
describe file('/tmp/demo1') do
it { should be_file }
its('content') { should match(%r{bar: two, foo: one}) }
end

0 comments on commit 5cce8f2

Please sign in to comment.