module-puppetdb/spec/unit/classes/master/config_spec.rb
Wyatt Alt f246e95e17 (maint) use 'puppetdb-terminus' on redhat with version 3+
This makes it possible to upgrade PDB from 2.x to 3+ on redhat without
explicitly specifying the terminus package name.
2016-02-09 11:29:58 -08:00

94 lines
3 KiB
Ruby

require 'spec_helper'
describe 'puppetdb::master::config', :type => :class do
before :each do
@facter_facts =
{
:fqdn => 'puppetdb.example.com',
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6.0',
:kernel => 'Linux',
:lsbdistid => 'Debian',
:lsbdistcodename => 'foo',
:concat_basedir => '/var/lib/puppet/concat',
:id => 'root',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
let (:facts) {@facter_facts}
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
it { should contain_package('puppetdb-termini').with( :ensure => 'present' )}
it { should contain_puppetdb_conn_validator('puppetdb_conn').with(:test_url => '/pdb/meta/v1/version')}
end
context 'when using an older puppetdb version' do
let (:pre_condition) { 'class { "puppetdb::globals": version => "2.2.0", }' }
it { should contain_package('puppetdb-terminus').with( :ensure => '2.2.0' )}
it { should contain_puppetdb_conn_validator('puppetdb_conn').with(:test_url => '/v3/version')}
end
context 'when using puppetdb 3+' do
let (:pre_condition) { 'class { "puppetdb::globals": version => "3.2.0", }'}
it { should contain_package('puppetdb-termini').with( :ensure => '3.2.0' )}
end
end
context 'when using puppetdb 3+' do
before :each do
@facter_facts[:osfamily] = "RedHat"
end
let (:pre_condition) { 'class {"puppetdb::globals": version => "3.2.0", }' }
it { should contain_package('puppetdb-terminus').with( :ensure => '3.2.0' )}
end
end