module-postgresql/spec/acceptance/alternative_port_spec.rb
Colleen Murphy 6ba3179916 Fix data directory handling
The change introduced in b781849882 added
a complex operation that was not handled correctly for all operating
systems. This fix includes the following corrections:

- Change the systemd config and reload systemd for datadir changes in
  RHEL 7, and move configuration for this into
  postgresql::server::config since it is managing both the PGDATA and
  PGPORT variables
- Make sure Debian systems stop the service before changing the datadir
- Recreate cert links after running initdb in Debian and early ubuntu
- Change the port in the port spec to avoid selinux issues
- Turn off selinux in pgdata spec to avoid selinux issues
- Correct syntax for describing presence of a directory in pgdata spec
- Move the pgdata spec to the end of the tests so that puppet doesn't
  have to manager purging and recreating the original datadir
- Update README to describe all caveats of using this parameter
2014-10-31 16:03:15 -07:00

28 lines
671 B
Ruby

require 'spec_helper_acceptance'
# These tests ensure that postgres can change itself to an alternative port
# properly.
describe 'postgres::server', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
it 'on an alternative port' do
pp = <<-EOS
class { 'postgresql::server': port => '55433' }
EOS
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe port(55433) do
it { is_expected.to be_listening }
end
it 'can connect with psql' do
psql('-p 55433 --command="\l" postgres', 'postgres') do |r|
expect(r.stdout).to match(/List of databases/)
end
end
end