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:
parent
5e99e00dbc
commit
a86dbdb500
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,5 @@
|
|||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
.bundled_gems/
|
.bundled_gems/
|
||||||
|
log/
|
||||||
|
junit/
|
||||||
|
.vagrant/
|
||||||
|
4
Gemfile
4
Gemfile
@ -27,4 +27,8 @@ group :development, :test do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :system_tests do
|
||||||
|
gem 'beaker-rspec', :require => false
|
||||||
|
end
|
||||||
|
|
||||||
# vim:ft=ruby
|
# vim:ft=ruby
|
||||||
|
@ -3,3 +3,10 @@
|
|||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Configures Ansible.
|
Configures Ansible.
|
||||||
|
|
||||||
|
## Run Tests
|
||||||
|
|
||||||
|
````
|
||||||
|
bundle install
|
||||||
|
bundle exec rspec
|
||||||
|
````
|
||||||
|
22
spec/acceptance/basic_spec.rb
Normal file
22
spec/acceptance/basic_spec.rb
Normal 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
|
21
spec/acceptance/files_spec.rb
Normal file
21
spec/acceptance/files_spec.rb
Normal 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
|
1
spec/acceptance/fixtures/default.pp
Normal file
1
spec/acceptance/fixtures/default.pp
Normal file
@ -0,0 +1 @@
|
|||||||
|
class { '::ansible': }
|
7
spec/acceptance/packages_spec.rb
Normal file
7
spec/acceptance/packages_spec.rb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user