puppetdb_ini_spec.rb 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. require 'spec_helper'
  2. describe 'puppetdb::server::puppetdb', :type => :class do
  3. context 'on a supported platform' do
  4. let(:facts) do
  5. {
  6. :osfamily => 'RedHat',
  7. :fqdn => 'test.domain.local',
  8. }
  9. end
  10. it { should contain_class('puppetdb::server::puppetdb') }
  11. describe 'when using default values' do
  12. it { should contain_ini_setting('puppetdb-connections-from-master-only').
  13. with(
  14. 'ensure' => 'absent',
  15. 'path' => '/etc/puppetlabs/puppetdb/conf.d/puppetdb.ini',
  16. 'section' => 'puppetdb',
  17. 'setting' => 'certificate-whitelist',
  18. 'value' => '/etc/puppetlabs/puppetdb/certificate-whitelist'
  19. )}
  20. it { should contain_file('/etc/puppetlabs/puppetdb/certificate-whitelist').
  21. with(
  22. 'ensure' => 'absent',
  23. 'owner' => 0,
  24. 'group' => 0,
  25. 'mode' => '0644',
  26. 'content' => ''
  27. )}
  28. it { should contain_file('/etc/puppetlabs/puppetdb/conf.d/puppetdb.ini').
  29. with(
  30. 'ensure' => 'file',
  31. 'owner' => 'puppetdb',
  32. 'group' => 'puppetdb',
  33. 'mode' => '0600'
  34. )}
  35. end
  36. describe 'when restricting access to puppetdb' do
  37. let(:params) do
  38. {
  39. 'certificate_whitelist' => [ 'puppetmaster' ]
  40. }
  41. end
  42. it { should contain_ini_setting('puppetdb-connections-from-master-only').
  43. with(
  44. 'ensure' => 'present',
  45. 'path' => '/etc/puppetlabs/puppetdb/conf.d/puppetdb.ini',
  46. 'section' => 'puppetdb',
  47. 'setting' => 'certificate-whitelist',
  48. 'value' => '/etc/puppetlabs/puppetdb/certificate-whitelist'
  49. )}
  50. it { should contain_file('/etc/puppetlabs/puppetdb/certificate-whitelist').
  51. with(
  52. 'ensure' => 'present',
  53. 'owner' => 0,
  54. 'group' => 0,
  55. 'mode' => '0644',
  56. 'content' => "puppetmaster\n"
  57. )}
  58. end
  59. end
  60. end