1 require 'spec_helper_acceptance'
3 # These tests ensure that postgres can change itself to an alternative pgdata
6 # Allow postgresql to use /tmp/* as a datadir
7 if fact('osfamily') == 'RedHat' and fact('selinux') == 'true'
11 describe 'postgresql::server', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
12 it 'on an alternative pgdata location' do
14 #file { '/var/lib/pgsql': ensure => directory, } ->
15 # needs_initdb will be true by default for all OS's except Debian
16 # in order to change the datadir we need to tell it explicitly to call initdb
17 class { 'postgresql::server': datadir => '/tmp/data', needs_initdb => true }
20 apply_manifest(pp, :catch_failures => true)
21 apply_manifest(pp, :catch_changes => true)
24 describe file('/tmp/data') do
25 it { should be_directory }
28 it 'can connect with psql' do
29 psql('--command="\l" postgres', 'postgres') do |r|
30 expect(r.stdout).to match(/List of databases/)