2015-09-01 23:27:51 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-09-16 00:21:33 +02:00
|
|
|
describe 'puppetdb::server::database', :type => :class do
|
2015-09-01 23:27:51 +02:00
|
|
|
context 'on a supported platform' do
|
|
|
|
let(:facts) do
|
|
|
|
{
|
|
|
|
:osfamily => 'RedHat',
|
|
|
|
:operatingsystem => 'RedHat',
|
|
|
|
:operatingsystemrelease => '7.0',
|
|
|
|
:fqdn => 'test.domain.local',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when setting database_ssl flag' do
|
|
|
|
let(:params) do
|
|
|
|
{
|
|
|
|
'database_ssl' => true,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
it { should contain_ini_setting('puppetdb_subname').
|
|
|
|
with(
|
|
|
|
'section' => 'database',
|
|
|
|
'setting' => 'subname',
|
|
|
|
'value' => '//localhost:5432/puppetdb?ssl=true'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when passing jdbc subparams' do
|
|
|
|
let(:params) do
|
|
|
|
{
|
|
|
|
'jdbc_ssl_properties' => '?ssl=true',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
it { should contain_ini_setting('puppetdb_subname').
|
|
|
|
with(
|
|
|
|
'section' => 'database',
|
|
|
|
'setting' => 'subname',
|
|
|
|
'value' => '//localhost:5432/puppetdb?ssl=true'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when passing both database_ssl and jdbc subparams' do
|
|
|
|
let(:params) do
|
|
|
|
{
|
|
|
|
'database_ssl' => true,
|
|
|
|
'jdbc_ssl_properties' => '?ssl=true&sslmode=verify-full',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
it { should contain_ini_setting('puppetdb_subname').
|
|
|
|
with(
|
|
|
|
'section' => 'database',
|
|
|
|
'setting' => 'subname',
|
|
|
|
'value' => '//localhost:5432/puppetdb?ssl=true&sslmode=verify-full'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-16 00:21:33 +02:00
|
|
|
describe 'puppetdb::server::read_database', :type => :class do
|
2015-09-01 23:27:51 +02:00
|
|
|
context 'on a supported platform' do
|
|
|
|
let(:facts) do
|
|
|
|
{
|
|
|
|
:osfamily => 'RedHat',
|
|
|
|
:operatingsystem => 'RedHat',
|
|
|
|
:operatingsystemrelease => '7.0',
|
|
|
|
:fqdn => 'test.domain.local',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when setting database_ssl flag' do
|
|
|
|
let(:params) do
|
|
|
|
{
|
|
|
|
# this sets read_database_host
|
|
|
|
'database_host' => 'localhost',
|
|
|
|
'database_ssl' => true,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
it { should contain_ini_setting('puppetdb_read_subname').
|
|
|
|
with(
|
|
|
|
'section' => 'read-database',
|
|
|
|
'setting' => 'subname',
|
|
|
|
'value' => '//localhost:5432/puppetdb?ssl=true'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when passing jdbc subparams' do
|
|
|
|
let(:params) do
|
|
|
|
{
|
|
|
|
'database_host' => 'localhost',
|
|
|
|
'jdbc_ssl_properties' => '?ssl=true',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
it { should contain_ini_setting('puppetdb_read_subname').
|
|
|
|
with(
|
|
|
|
'section' => 'read-database',
|
|
|
|
'setting' => 'subname',
|
|
|
|
'value' => '//localhost:5432/puppetdb?ssl=true'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'when passing both database_ssl and jdbc subparams' do
|
|
|
|
let(:params) do
|
|
|
|
{
|
|
|
|
'database_host' => 'localhost',
|
|
|
|
'database_ssl' => true,
|
|
|
|
'jdbc_ssl_properties' => '?ssl=true&sslmode=verify-full',
|
|
|
|
}
|
|
|
|
end
|
|
|
|
it { should contain_ini_setting('puppetdb_read_subname').
|
|
|
|
with(
|
|
|
|
'section' => 'read-database',
|
|
|
|
'setting' => 'subname',
|
|
|
|
'value' => '//localhost:5432/puppetdb?ssl=true&sslmode=verify-full'
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|