1
0
mirror of https://github.com/krislamo/puppet-rsnapshot synced 2024-11-10 00:00:35 +00:00

Merge branch 'master' into develop

This commit is contained in:
Norbert Varzariu 2017-04-24 18:57:57 +02:00
commit 2590264764
6 changed files with 111 additions and 3 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
Gemfile.lock Gemfile.lock
pkg/ pkg/
vendor/ vendor/
log/

View File

@ -2,13 +2,20 @@
sudo: false sudo: false
language: ruby language: ruby
cache: bundler cache: bundler
bundler_args: --without system_tests
script: "bundle exec rake validate && bundle exec rake spec SPEC_OPTS='--format documentation'"
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
rvm: 2.1 - rvm: 2.1
env: PUPPET_GEM_VERSION="~> 4.0" env: PUPPET_GEM_VERSION="~> 4.0"
script: "bundle exec rake validate"
- rvm: 2.1
env: PUPPET_GEM_VERSION="~> 4.0"
script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
- rvm: 2.1
env: PUPPET_GEM_VERSION="~> 4.0"
script: "bundle exec rake beaker"
services: docker
sudo: required
notifications: notifications:
email: false email: false

View File

@ -6,3 +6,9 @@ gem 'puppetlabs_spec_helper', '>= 0.8.2'
gem 'puppet-lint', '>= 1.0.0' gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0' gem 'facter', '>= 1.7.0'
gem 'metadata-json-lint' gem 'metadata-json-lint'
group :acceptance do
gem 'beaker-rspec', '5.6.0'
gem 'serverspec', require: false
gem 'specinfra', require: false
end

View File

@ -0,0 +1,53 @@
require 'spec_helper_acceptance'
describe 'rsnapshot' do
context 'with defaults' do
it 'run idempotently' do
pp = <<-EOS
class { 'rsnapshot':
hosts => {
'localhost' => {},
'example.com' => {
backup_defaults => false,
backup => {
'/var/' => './'
}
}
}
}
EOS
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end
end
context 'packages installed' do
describe package('rsnapshot') do
it { is_expected.to be_installed }
end
end
context 'files provisioned' do
describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'backup' }
end
describe file('/etc/rsnapshot/example.com.rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'backup' }
end
describe file('/etc/rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'localhost' }
its(:content) { is_expected.to match 'example.com' }
end
describe file('/etc/rsnapshot/localhost.rsnapshot.conf') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'backup' }
end
describe file('/etc/cron.d/example_com') do
it { is_expected.to exist }
its(:content) { is_expected.to match 'example.com' }
end
end
end

View File

@ -0,0 +1,15 @@
HOSTS:
debian-8-x64:
platform: debian-8-amd64
hypervisor: docker
image: debian:8
docker_container_name: puppet_rsnapshot
docker_preserve_image: true
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'echo deb http://ftp.debian.org/debian jessie-backports main >> /etc/apt/sources.list'
- 'apt-get update && apt-get install -y cron locales-all net-tools wget'
- 'rm -f /usr/sbin/policy-rc.d'
CONFIG:
trace_limit: 200
masterless: true

View File

@ -0,0 +1,26 @@
require 'puppet'
require 'beaker-rspec'
require 'yaml'
install_puppet_agent_on hosts, {}
RSpec.configure do |c|
# Module root and settings
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
module_name = module_root.split('/').last.sub('-', '_').split('_').last()
c.formatter = :documentation
c.max_displayed_failure_line_count = 5
c.before :suite do
puts 'Install module'
puppet_module_install(source: module_root, module_name: module_name)
hosts.each do |host|
puts 'Install fixtures'
on host, puppet('module','install','stahnma/epel')
on host, puppet('module','install','puppetlabs/stdlib')
on host, puppet('module','install','puppetlabs/concat')
end
end
end