module-puppetdb/spec/unit/classes/server/config_ini_spec.rb
Sebastian Reitenbach 72e1924b11 Enable the module to manage entries in $confdir/config.ini, in the
command-processing section.

Added new class server/config_ini.pp to manage contents of the config.ini.
Three new parameters added:
  * command_threads
  * store_usage
  * temp_usage

All three default to 'undef'. This makes sure (potential) custom settings
done to that file with regard to above three variables are 'absent',
and let PuppetDB built-in defaults take care.

Documentation to the README.md added, as well as unit tests.

My use-case was, that I have on some nodes a too small /var partition,
so I had to lower the values of store-usage and temp-usage in the config.ini
manually.
2015-04-22 06:19:35 +02:00

71 lines
2.4 KiB
Ruby

require 'spec_helper'
describe 'puppetdb::server::config_ini', :type => :class do
context 'on a supported platform' do
let(:facts) do
{
:osfamily => 'OpenBSD',
}
end
it { should contain_class('puppetdb::server::config_ini') }
describe 'when using default values' do
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
with(
'ensure' => 'absent',
'path' => '/etc/puppetdb/conf.d/config.ini',
'section' => 'command-processing',
'setting' => 'threads'
)}
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
with(
'ensure' => 'absent',
'path' => '/etc/puppetdb/conf.d/config.ini',
'section' => 'command-processing',
'setting' => 'store-usage'
)}
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
with(
'ensure' => 'absent',
'path' => '/etc/puppetdb/conf.d/config.ini',
'section' => 'command-processing',
'setting' => 'temp-usage'
)}
end
describe 'when using custom values' do
let(:params) do
{
'command_threads' => 10,
'store_usage' => 4000,
'temp_usage' => 2000,
}
end
it { should contain_ini_setting('puppetdb_config_command_processing_threads').
with(
'ensure' => 'present',
'path' => '/etc/puppetdb/conf.d/config.ini',
'section' => 'command-processing',
'setting' => 'threads',
'value' => '10'
)}
it { should contain_ini_setting('puppetdb_config_command_processing_store_usage').
with(
'ensure' => 'present',
'path' => '/etc/puppetdb/conf.d/config.ini',
'section' => 'command-processing',
'setting' => 'store-usage',
'value' => '4000'
)}
it { should contain_ini_setting('puppetdb_config_command_processing_temp_usage').
with(
'ensure' => 'present',
'path' => '/etc/puppetdb/conf.d/config.ini',
'section' => 'command-processing',
'setting' => 'temp-usage',
'value' => '2000'
)}
end
end
end