6e562592da01f105bc59befff9e3275388b72fe2
[mirror/dsa-puppet.git] / 3rdparty / modules / postgresql / spec / acceptance / server / config_entry_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'postgresql::server::config_entry' do
4
5   let(:pp_setup) { <<-EOS
6     class { 'postgresql::server':
7       postgresql_conf_path => '/tmp/postgresql.conf',
8       }
9     EOS
10   }
11
12   context 'unix_socket_directories' do
13     let(:pp_test) { pp_setup + <<-EOS
14       postgresql::server::config_entry { 'unix_socket_directories':
15         value => '/var/socket/, /root/'
16       }
17       EOS
18     }
19
20     #get postgresql version
21     apply_manifest("class { 'postgresql::server': }")
22     result = shell('psql --version')
23     version = result.stdout.match(%r{\s(\d\.\d)})[1]
24
25     if version >= '9.3'
26       it 'is expected to run idempotently' do
27         apply_manifest(pp_test, :catch_failures => true)
28         apply_manifest(pp_test, :catch_changes => true)
29       end
30
31       it 'is expected to contain directories' do
32         shell('cat /tmp/postgresql.conf') do |output|
33           expect(output.stdout).to contain("unix_socket_directories = '/var/socket/, /root/'")
34         end
35       end
36     end
37   end
38 end