module-puppetdb/spec/unit/classes/master/config_spec.rb
Andrew Roetker 829626f6cb (PDB-1485) Add default PuppetDB root context
This commit changes the terminus configuration to use the new root
prefix for PuppetDB and changes the connection validator to do the same.

This commit also adds the terminus package name changes `terminus` to
`termini` and tries to be smart about the default, checking to see what
version of PuppetDB was passed in and defaulting off of that value.
2015-06-03 11:20:09 -07:00

79 lines
2.5 KiB
Ruby

require 'spec_helper'
describe 'puppetdb::master::config', :type => :class do
let(:facts) do
{
:fqdn => 'puppetdb.example.com',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6.0',
:kernel => 'Linux',
:concat_basedir => '/var/lib/puppet/concat',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
context 'when PuppetDB on remote server' do
context 'when using default values' do
it { should compile.with_all_deps }
end
end
context 'when PuppetDB and Puppet Master are on the same server' do
context 'when using default values' do
let(:pre_condition) { 'class { "puppetdb": }' }
it { should contain_puppetdb_conn_validator('puppetdb_conn').with(
:puppetdb_server => 'puppetdb.example.com',
:puppetdb_port => '8081',
:use_ssl => 'true') }
end
context 'when puppetdb class is declared with disable_ssl => true' do
let(:pre_condition) { 'class { "puppetdb": disable_ssl => true }' }
it { should contain_puppetdb_conn_validator('puppetdb_conn').with(
:puppetdb_port => '8080',
:use_ssl => 'false')}
end
context 'when puppetdb_port => 1234' do
let(:pre_condition) { 'class { "puppetdb": }' }
let(:params) do { :puppetdb_port => '1234' } end
it { should contain_puppetdb_conn_validator('puppetdb_conn').with(
:puppetdb_port => '1234',
:use_ssl => 'true')}
end
context 'when puppetdb_port => 1234 AND the puppetdb class is declared with disable_ssl => true' do
let(:pre_condition) { 'class { "puppetdb": disable_ssl => true }' }
let(:params) do {:puppetdb_port => '1234'} end
it { should contain_puppetdb_conn_validator('puppetdb_conn').with(
:puppetdb_port => '1234',
:use_ssl => 'false')}
end
context 'when using default values' do
let (:pre_condition) { 'class { "puppetdb": }' }
it { should contain_package('puppetdb-termini').with( :ensure => 'present' )}
end
context 'when using an older puppetdb version' do
let (:pre_condition) { 'class { "puppetdb": puppetdb_version => "2.2.0", }' }
let (:params) do { :puppetdb_version => '2.2.0' } end
it { should contain_package('puppetdb-terminus').with( :ensure => '2.2.0' )}
end
end
end