1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- require 'spec_helper_system'
- describe 'non defaults:' do
- context 'test installing non-default version of postgresql' do
- after :each do
- # Cleanup
- psql('--command="drop database postgresql_test_db" postgres')
- pp = <<-EOS
- class { "postgresql":
- version => "9.2",
- manage_package_repo => true,
- }->
- class { 'postgresql::server':
- ensure => absent,
- service_status => 'service postgresql-9.2 status',
- }
- EOS
- puppet_apply(pp)
- end
- it 'perform installation and create a db' do
- pp = <<-EOS
- # Configure version and manage_package_repo globally, install postgres
- # and then try to install a new database.
- class { "postgresql":
- version => "9.2",
- manage_package_repo => true,
- }->
- class { "postgresql::server": }->
- postgresql::db { "postgresql_test_db":
- user => "foo1",
- password => "foo1",
- }
- EOS
- puppet_apply(pp) do |r|
- # Currently puppetlabs/apt shows deprecated messages
- #r.stderr.should be_empty
- [2,6].should include(r.exit_code)
- end
- puppet_apply(pp) do |r|
- # Currently puppetlabs/apt shows deprecated messages
- #r.stderr.should be_empty
- # It also returns a 4
- [0,4].should include(r.exit_code)
- end
- psql('postgresql_test_db --command="select datname from pg_database limit 1"')
- end
- end
- context 'override locale and charset' do
- it 'perform installation with different locale and charset' do
- puts node.facts.inspect
- pending('no support for locale parameter with centos 5', :if => (node.facts['osfamily'] == 'RedHat' and node.facts['lsbmajdistrelease'] == '5'))
- pending('no support for initdb with debian/ubuntu', :if => (node.facts['osfamily'] == 'Debian'))
- # TODO: skip for ubuntu and centos 5
- pp = <<-EOS
- # Set global locale and charset option, and try installing postgres
- class { 'postgresql':
- locale => 'en_NG',
- charset => 'UTF8',
- }->
- class { 'postgresql::server': }
- EOS
- puppet_apply(pp) do |r|
- # Currently puppetlabs/apt shows deprecated messages
- #r.stderr.should be_empty
- # It also returns a 6
- [2,6].should include(r.exit_code)
- end
- puppet_apply(pp) do |r|
- # Currently puppetlabs/apt shows deprecated messages
- #r.stderr.should be_empty
- # It also returns a 2
- [0,4].should include(r.exit_code)
- end
- # Remove db first, if it exists for some reason
- shell('su postgres -c "dropdb test1"')
- shell('su postgres -c "createdb test1"')
- shell('su postgres -c \'psql -c "show lc_ctype" test1\'') do |r|
- r.stdout.should =~ /en_NG/
- end
- shell('su postgres -c \'psql -c "show lc_collate" test1\'') do |r|
- r.stdout.should =~ /en_NG/
- end
- end
- end
- end
|