Skip to content

Commit 1ae819c

Browse files
author
Daniel Carabas
committed
Add collect tests
1 parent 74bab5b commit 1ae819c

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

spec/acceptance/collect_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 'check collect with default values' do
4+
before(:all) do
5+
pp = <<-MANIFEST
6+
include pe_databases
7+
MANIFEST
8+
idempotent_apply(pp)
9+
end
10+
context 'check if service files are created' do
11+
it 'service files are created' do
12+
files = run_shell('ls /etc/systemd/system/pe_databases-*.service').stdout
13+
expect(files.split("\n").count).to be >= 3
14+
end
15+
it 'service timer files are created' do
16+
files = run_shell('ls /etc/systemd/system/pe_databases-*.timer').stdout
17+
expect(files.split("\n").count).to be >= 3
18+
end
19+
end
20+
end

spec/acceptance/init_spec.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@
1313
end
1414

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

spec/spec_helper_acceptance_local.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ class LitmusHelper
99
include PuppetLitmus
1010
end
1111

12-
pp = <<-MANIFEST
13-
package { 'crontab':
12+
RSpec.configure do |c|
13+
c.before :suite do
14+
pp = <<-MANIFEST
15+
package { 'cron':
1416
ensure => installed,
15-
name => 'crontab'
17+
name => 'cron'
1618
}
1719
MANIFEST
1820

19-
LitmusHelper.instance.apply_manifest(pp)
21+
LitmusHelper.instance.apply_manifest(pp)
22+
end
23+
end

0 commit comments

Comments
 (0)