Skip to content

Commit 79fbc11

Browse files
author
Daniel Carabas
committed
Add backup acceptance tests
1 parent 3dce4e4 commit 79fbc11

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

spec/acceptance/backup_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
require 'spec_helper_acceptance'
2+
3+
describe 'pe_databases with manage database backups' do
4+
it 'applies the class with default parameters' do
5+
pp = <<-MANIFEST
6+
class { 'pe_databases':
7+
manage_database_backups => true
8+
}#{' '}
9+
MANIFEST
10+
11+
# Run it twice and test for idempotency
12+
idempotent_apply(pp)
13+
end
14+
it 'checks if backup cron jobs are up' do
15+
run_shell('crontab -l -u pe-postgres') do |r|
16+
expect(r.stdout).to match(%r{pe-activity, pe-classifier, pe-inventory, pe-orchestrator, pe-postgres, pe-rbac})
17+
expect(r.stdout).to match(%r{pe-puppetdb})
18+
end
19+
end
20+
end

spec/acceptance/init_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@
1414

1515
describe 'check pe_databases script directory' do
1616
it 'scripts folder exists' do
17-
file('/opt/puppetlabs/pe_databases/scripts').should be_directory
17+
expect(file('/opt/puppetlabs/pe_databases/scripts')).to be_directory
18+
end
19+
end
20+
21+
describe 'check systemd fact' do
22+
it 'is true on all supported OS' do
23+
expect(host_inventory['facter']['pe_databases']['have_systemd']).to eq true
1824
end
1925
end
2026
end

spec/spec_helper_acceptance_local.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@ class LitmusHelper
1010
end
1111

1212
RSpec.configure do |c|
13-
c.before :suite do
14-
pp = <<-MANIFEST
15-
package { 'cron':
16-
ensure => installed,
17-
name => 'cron'
18-
}
19-
MANIFEST
20-
21-
LitmusHelper.instance.apply_manifest(pp)
13+
c.before :all do
14+
LitmusHelper.instance.run_shell('/opt/puppetlabs/bin/puppet plugin download')
15+
LitmusHelper.instance.run_shell('sudo apt-get install -y cron') if os[:family] == 'ubuntu'
2216
end
2317
end

0 commit comments

Comments
 (0)