Fix up and add some tests for unknown OS patch
This patch just adds some new tests for the unknown OS patch, and cleans up some existing tests to look for the new warning message. Also, change the warning message for $osfamily and manage_package_repo to reflect the parameter at fault. Signed-off-by: Ken Barber <ken@bob.sh>
This commit is contained in:
parent
6bd2befa98
commit
f6fb18a5b3
4 changed files with 102 additions and 31 deletions
|
@ -79,7 +79,7 @@ class postgresql::params(
|
|||
}
|
||||
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports osfamily RedHat and Debian")
|
||||
fail("Unsupported osfamily for manage_package_repo: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports managing repos for osfamily RedHat and Debian")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,71 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'postgresql', :type => :class do
|
||||
let :facts do
|
||||
{
|
||||
:postgres_default_version => '8.4',
|
||||
:osfamily => 'Debian',
|
||||
}
|
||||
end
|
||||
it { should include_class("postgresql") }
|
||||
|
||||
context 'support override params' do
|
||||
let(:params) {{
|
||||
:version => '8.4',
|
||||
:manage_package_repo => true,
|
||||
:package_source => '',
|
||||
:locale => 'en_NG',
|
||||
:charset => 'UTF8',
|
||||
:datadir => '/srv/pgdata',
|
||||
:confdir => '/opt/pg/etc',
|
||||
:bindir => '/opt/pg/bin',
|
||||
:client_package_name => 'my-postgresql-client',
|
||||
:server_package_name => 'my-postgresql-server',
|
||||
:contrib_package_name => 'my-postgresql-contrib',
|
||||
:devel_package_name => 'my-postgresql-devel',
|
||||
:java_package_name => 'my-postgresql-java',
|
||||
:service_name => 'my-postgresql',
|
||||
:user => 'my-postgresql',
|
||||
:group => 'my-postgresql',
|
||||
:run_initdb => true,
|
||||
}}
|
||||
|
||||
describe 'with supported os' do
|
||||
let :facts do
|
||||
{
|
||||
:postgres_default_version => '8.4',
|
||||
:osfamily => 'Debian',
|
||||
}
|
||||
end
|
||||
it { should include_class("postgresql") }
|
||||
it { should include_class("postgresql::params") }
|
||||
|
||||
context 'support override params' do
|
||||
let(:params) {{
|
||||
:version => '8.4',
|
||||
:manage_package_repo => true,
|
||||
:package_source => '',
|
||||
:locale => 'en_NG',
|
||||
:charset => 'UTF8',
|
||||
:datadir => '/srv/pgdata',
|
||||
:confdir => '/opt/pg/etc',
|
||||
:bindir => '/opt/pg/bin',
|
||||
:client_package_name => 'my-postgresql-client',
|
||||
:server_package_name => 'my-postgresql-server',
|
||||
:contrib_package_name => 'my-postgresql-contrib',
|
||||
:devel_package_name => 'my-postgresql-devel',
|
||||
:java_package_name => 'my-postgresql-java',
|
||||
:service_name => 'my-postgresql',
|
||||
:user => 'my-postgresql',
|
||||
:group => 'my-postgresql',
|
||||
:run_initdb => true,
|
||||
}}
|
||||
|
||||
it { should include_class("postgresql") }
|
||||
it { should include_class("postgresql::params") }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with unsupported os' do
|
||||
let :facts do
|
||||
{
|
||||
:postgres_default_version => '8.4',
|
||||
:osfamily => 'foo',
|
||||
}
|
||||
end
|
||||
|
||||
context 'support override params' do
|
||||
let(:params) {{
|
||||
:version => '8.4',
|
||||
:package_source => '',
|
||||
:locale => 'en_NG',
|
||||
:charset => 'UTF8',
|
||||
:datadir => '/srv/pgdata',
|
||||
:confdir => '/opt/pg/etc',
|
||||
:bindir => '/opt/pg/bin',
|
||||
:client_package_name => 'my-postgresql-client',
|
||||
:server_package_name => 'my-postgresql-server',
|
||||
:contrib_package_name => 'my-postgresql-contrib',
|
||||
:devel_package_name => 'my-postgresql-devel',
|
||||
:java_package_name => 'my-postgresql-java',
|
||||
:service_name => 'my-postgresql',
|
||||
:user => 'my-postgresql',
|
||||
:group => 'my-postgresql',
|
||||
:run_initdb => true,
|
||||
}}
|
||||
|
||||
it { should include_class("postgresql") }
|
||||
it { should include_class("postgresql::params") }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,4 +35,16 @@ describe 'postgresql::java', :type => :class do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'on any other os' do
|
||||
let :facts do {
|
||||
:osfamily => 'foo',
|
||||
:postgres_default_version => 'foo',
|
||||
}
|
||||
end
|
||||
|
||||
it 'should fail without all the necessary parameters' do
|
||||
expect { subject }.to raise_error(/Module postgresql does not provide defaults for osfamily: foo/)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -26,4 +26,28 @@ describe 'postgresql::python', :type => :class do
|
|||
)}
|
||||
end
|
||||
|
||||
describe 'on any other os' do
|
||||
let :facts do {
|
||||
:osfamily => 'foo',
|
||||
:postgres_default_version => 'foo',
|
||||
}
|
||||
end
|
||||
|
||||
it 'should fail without all the necessary parameters' do
|
||||
expect { subject }.to raise_error(/Module postgresql does not provide defaults for osfamily: foo/)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'on any other os without all the necessary parameters' do
|
||||
let :facts do {
|
||||
:osfamily => 'foo',
|
||||
:postgres_default_version => 'foo',
|
||||
}
|
||||
end
|
||||
|
||||
it 'should fail' do
|
||||
expect { subject }.to raise_error(/Module postgresql does not provide defaults for osfamily: foo/)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue