summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Filion <gabster@lelutin.ca>2016-06-29 17:05:54 +0200
committerGabriel Filion <gabster@lelutin.ca>2016-06-29 17:05:54 +0200
commit354bada72153cfe29f0e91b0fff16d1eeaf5f0e2 (patch)
tree5aff9d4584661a9e2b65c985704b11abb433467e
parenta8755365321bccf7a5c7a9a0fc9883b3176a1d37 (diff)
parent005f06f3dde8198fac2ca1a0206e05157e927d3c (diff)
Merge remote-tracking branch 'varac/beaker' into blah
The README file has been changed, use the new syntax to match the rest of the file.
-rw-r--r--.gitignore1
-rw-r--r--Gemfile7
-rw-r--r--README.md22
-rw-r--r--spec/acceptance/apt_spec.rb21
-rw-r--r--spec/acceptance/nodesets/debian-8-x86_64-docker.yml19
l---------spec/acceptance/nodesets/default.yml1
-rw-r--r--spec/spec_helper_acceptance.rb18
7 files changed, 89 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index a54aa97..3b626b8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
/spec/fixtures/modules/*
!/spec/fixtures/modules/apt
!/spec/fixtures/modules/apt/*
+/log
/.vagrant/
/.bundle/
/coverage/
diff --git a/Gemfile b/Gemfile
index 8925a90..a2756c4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -11,3 +11,10 @@ group :test do
gem "rspec-puppet-facts"
gem "mocha"
end
+
+group :system_tests do
+ gem 'beaker', :require => false
+ gem 'beaker-rspec', :require => false
+ gem 'beaker_spec_helper', :require => false
+ gem 'serverspec', :require => false
+end
diff --git a/README.md b/README.md
index f6a0c4a..41a9aeb 100644
--- a/README.md
+++ b/README.md
@@ -644,11 +644,33 @@ To run pupept rspec tests:
bundle install --path vendor/bundle
bundle exec rake spec
+Verbose Output:
+
+ bundle exec rake spec SPEC_OPTS='--format documentation'
+
Using different facter/puppet versions:
FACTER_GEM_VERSION=1.6.10 PUPPET_GEM_VERSION=2.7.23 bundle install --path vendor/bundle
bundle exec rake spec
+## Acceptance Tests<a name="acceptance-tests"></a>
+
+At the moment, we use [beaker together with docker](https://github.com/puppetlabs/beaker/blob/master/docs/Docker-Support.md)
+to do acceptance testing.
+Be sure to have a recent docker version installed.
+
+List configured nodesets:
+
+ bundle exec rake beaker_nodes
+
+Run tests on default node (Debian Jessie):
+
+ bundle exec rake beaker
+
+Run different nodeset:
+
+ BEAKER_set="debian-8-x86_64-docker" bundle exec rspec spec/acceptance/*_spec.rb
+
# Licensing<a name="licensing"></a>
diff --git a/spec/acceptance/apt_spec.rb b/spec/acceptance/apt_spec.rb
new file mode 100644
index 0000000..a976a56
--- /dev/null
+++ b/spec/acceptance/apt_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper_acceptance'
+
+describe 'apt class' do
+
+ context 'default parameters' do
+ it 'should work idempotently with no errors' do
+ pp = <<-EOS
+ class { 'apt': }
+ EOS
+
+ # Run it twice and test for idempotency
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+ end
+
+ describe package('apt') do
+ it { is_expected.to be_installed }
+ end
+
+ end
+end
diff --git a/spec/acceptance/nodesets/debian-8-x86_64-docker.yml b/spec/acceptance/nodesets/debian-8-x86_64-docker.yml
new file mode 100644
index 0000000..f09ad62
--- /dev/null
+++ b/spec/acceptance/nodesets/debian-8-x86_64-docker.yml
@@ -0,0 +1,19 @@
+HOSTS:
+ debian-8-x64:
+ platform: debian-8-amd64
+ image: debian:8
+ hypervisor: docker
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y wget locales-all puppet git'
+ - 'rm -f /usr/sbin/policy-rc.d'
+
+CONFIG:
+ type: foss
+ #log_level: verbose
+ #log_level: debug
+
+ssh:
+ password: root
+ auth_methods: ["password"]
diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml
new file mode 120000
index 0000000..b125a96
--- /dev/null
+++ b/spec/acceptance/nodesets/default.yml
@@ -0,0 +1 @@
+debian-8-x86_64-docker.yml \ No newline at end of file
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
new file mode 100644
index 0000000..1ccd84d
--- /dev/null
+++ b/spec/spec_helper_acceptance.rb
@@ -0,0 +1,18 @@
+require 'beaker-rspec'
+
+RSpec.configure do |c|
+ module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+ module_name = module_root.split('-').last
+
+ # Readable test descriptions
+ c.formatter = :documentation
+
+ # Configure all nodes in nodeset
+ c.before :suite do
+ # Install module and dependencies
+ puppet_module_install(:source => module_root, :module_name => module_name)
+ hosts.each do |host|
+ shell('git clone https://gitlab.com/shared-puppet-modules-group/common.git /etc/puppet/modules/common')
+ end
+ end
+end