Skip to content

Commit ca11b25

Browse files
author
Martin Alfke
committed
acceptance testing
- add .fixtures.yml to build sandbox - add spec_helper and spec_helper_acceptance - add default nodeset (docker centos7) - add first profile test
1 parent 78e486f commit ca11b25

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed

.fixtures.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fixtures:
2+
symlinks:
3+
site: "#{source_dir}/site"
4+
r10k: "#{source_dir}/modules"

spec/acceptance/nodesets/default.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
HOSTS:
2+
centos-7-x64:
3+
platform: el-7-x86_64
4+
hypervisor : docker
5+
image: centos:centos7
6+
docker_preserve_image: false
7+
mount_folders:
8+
controlrepo:
9+
host_path: .
10+
container_path: /etc/puppetlabs/code/environments/production
11+
docker_cmd: '["/usr/sbin/init"]'
12+
docker_image_commands:
13+
- 'yum -y swap -- remove fakesystemd -- install systemd systemd-libs'
14+
- 'yum -y install cronie initscripts which'
15+
- 'yum -y update; yum clean all'
16+
- 'rm -fr /var/cache/yum/x86_64/7/* /etc/yum.repos.d/*.repo'
17+
CONFIG:
18+
type: foss
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'profile::base::linux' do
4+
let(:manifest) {
5+
<<-EOS
6+
include profile::base::linux
7+
EOS
8+
}
9+
it 'should run without errors' do
10+
result = apply_manifest(manifest, :catch_failures => true)
11+
expect(@result.exit_code).to eq 2
12+
end
13+
it 'should run a second time without changes' do
14+
result = apply_manifest(manifest, :catch_changes => true)
15+
expect(@result.exit_code).to eq 0
16+
end
17+
end

spec/spec_helper.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require 'puppetlabs_spec_helper/module_spec_helper'
2+
3+
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
4+
5+
support_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec/support/*.rb'))
6+
Dir[support_path].each {|f| require f}
7+
8+
RSpec.configure do |c|
9+
c.module_path = File.join(fixture_path, 'modules/site') + ':' + File.join(fixture_path, 'modules/r10k')
10+
c.manifest_dir = File.join(fixture_path, 'manifests')
11+
c.hiera_config = File.join(fixture_path, '../../hiera.yaml')
12+
c.fail_fast = true
13+
end
14+
15+
at_exit { RSpec::Puppet::Coverage.report! }

spec/spec_helper_acceptance.rb

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'beaker-rspec'
2+
3+
hosts.each do |host|
4+
# Install Puppet
5+
install_puppet_agent_on(host)
6+
end
7+
8+
RSpec.configure do |c|
9+
# Project root
10+
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
11+
# Readable test descriptions
12+
c.formatter = :documentation
13+
# Configure all nodes in nodeset
14+
c.before :suite do
15+
hosts.each do |host|
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)