Skip to content

Commit

Permalink
Add spec test to ensure correct behavior across PE versions
Browse files Browse the repository at this point in the history
This spec test makes sure that the pg_repack class is included
on versions of PE that support it and is not included on versions
that do not support it.
  • Loading branch information
npwalker committed Jan 5, 2019
1 parent 29dcf4a commit 1b4bcf1
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions spec/classes/maintenance_spec.rb
@@ -0,0 +1,45 @@
require 'spec_helper'

describe 'pe_databases::maintenance' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:pre_condition) { "class { 'pe_databases': }" }
let(:facts) { os_facts }

it { is_expected.to compile }

context "on PE 2019.0.0" do
before(:each) do
facts['pe_server_version'] = '2019.0.0'
end

it { should contain_class('pe_databases::maintenance::vacuum_full')}
it { should_not contain_class('pe_databases::maintenance::pg_repack')}
end
context "on PE 2018.1.4" do
before(:each) do
facts['pe_server_version'] = '2018.1.4'
end

it { should contain_class('pe_databases::maintenance::vacuum_full')}
it { should_not contain_class('pe_databases::maintenance::pg_repack')}
end
context "on PE 2018.1.8" do
before(:each) do
facts['pe_server_version'] = '2018.1.9'
end

it { should contain_class('pe_databases::maintenance::vacuum_full').with( { 'disable_maintenance' => true }) }
it { should contain_class('pe_databases::maintenance::pg_repack')}
end
context "on PE 2019.0.3" do
before(:each) do
facts['pe_server_version'] = '2019.0.3'
end

it { should contain_class('pe_databases::maintenance::vacuum_full').with( { 'disable_maintenance' => true }) }
it { should contain_class('pe_databases::maintenance::pg_repack')}
end
end
end
end

0 comments on commit 1b4bcf1

Please sign in to comment.