Add acceptance tests for puppet-ansible.

Add acceptance tests for puppet-ansible module so that once the module
is applied we check if files were created and packages were installed.

Co-Authored-By: Bruno Tavares <btavare@thoughtworks.com>
Change-Id: Ic569a70737f7e9d0a86c14e1f299b308ab9d3986
This commit is contained in:
Danilo Ramalho 2015-09-21 19:23:01 -03:00
parent 5e99e00dbc
commit a86dbdb500
7 changed files with 65 additions and 0 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
Gemfile.lock
.bundled_gems/
log/
junit/
.vagrant/

View File

@ -27,4 +27,8 @@ group :development, :test do
end
group :system_tests do
gem 'beaker-rspec', :require => false
end
# vim:ft=ruby

View File

@ -3,3 +3,10 @@
## Overview
Configures Ansible.
## Run Tests
````
bundle install
bundle exec rspec
````

View File

@ -0,0 +1,22 @@
require 'spec_helper_acceptance'
describe 'puppet-ansible module' do
def pp_path
base_path = File.dirname(__FILE__)
File.join(base_path, 'fixtures')
end
def default_puppet_module
module_path = File.join(pp_path, 'default.pp')
File.read(module_path)
end
it 'should work with no errors' do
apply_manifest(default_puppet_module, catch_failures: true)
end
it 'should be idempotent' do
apply_manifest(default_puppet_module, catch_failures: true)
apply_manifest(default_puppet_module, catch_changes: true)
end
end

View File

@ -0,0 +1,21 @@
require 'spec_helper_acceptance'
describe 'required files' do
describe file('/etc/ansible/ansible.cfg') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its(:content) { should include 'library=/usr/share/ansible' }
end
describe file('/usr/local/bin/puppet-inventory') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its(:content) { should include "'_meta': {'hostvars': dict()}," }
end
describe file('/etc/logrotate.d/ansible') do
its(:content) { should include '/var/log/ansible.log' }
end
end

View File

@ -0,0 +1 @@
class { '::ansible': }

View File

@ -0,0 +1,7 @@
require 'spec_helper_acceptance'
describe 'required python package' do
describe package('ansible') do
it { should be_installed.by('pip') }
end
end