Skip to content

Commit 40aeef0

Browse files
author
Daniel Carabas
committed
Add backup acceptance tests
1 parent 3dce4e4 commit 40aeef0

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
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: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ class LitmusHelper
1111

1212
RSpec.configure do |c|
1313
c.before :suite do
14+
LitmusHelper.instance.run_shell('/opt/puppetlabs/bin/puppet plugin download')
1415
pp = <<-MANIFEST
15-
package { 'cron':
16-
ensure => installed,
17-
name => 'cron'
18-
}
19-
MANIFEST
20-
16+
package { 'cron':
17+
ensure => 'latest',
18+
}
19+
MANIFEST
2120
LitmusHelper.instance.apply_manifest(pp)
2221
end
2322
end

0 commit comments

Comments
 (0)