1 require 'spec_helper_system'
3 describe 'non defaults:' do
6 if($::operatingsystem =~ /Debian|Ubuntu/) {
7 # Need to make sure the correct utf8 locale is ready for our
9 file { '/etc/locale.gen':
10 content => "en_US ISO-8859-1\nen_NG UTF-8\nen_US UTF-8\n",
12 exec { '/usr/sbin/locale-gen':
20 context 'test installing non-default version of postgresql' do
23 psql('--command="drop database postgresql_test_db" postgres')
27 manage_package_repo => true,
29 class { 'postgresql::server':
31 service_status => 'service postgresql-9.2 status',
37 it 'perform installation and create a db' do
39 # Configure version and manage_package_repo globally, install postgres
40 # and then try to install a new database.
43 manage_package_repo => true,
45 locale => 'en_US.UTF-8',
47 class { "postgresql::server": }->
48 postgresql::db { "postgresql_test_db":
50 password => postgresql_password('foo1', 'foo1'),
52 class { "postgresql::plperl": }
55 puppet_apply(pp) do |r|
56 # Currently puppetlabs/apt shows deprecated messages
57 #r.stderr.should be_empty
58 [2,6].should include(r.exit_code)
61 puppet_apply(pp) do |r|
62 # Currently puppetlabs/apt shows deprecated messages
63 #r.stderr.should be_empty
65 [0,4].should include(r.exit_code)
68 psql('postgresql_test_db --command="select datname from pg_database limit 1"')
72 context 'override locale and charset' do
73 it 'perform installation with different locale and charset' do
74 puts node.facts.inspect
75 pending('no support for locale parameter with centos 5', :if => (node.facts['osfamily'] == 'RedHat' and node.facts['lsbmajdistrelease'] == '5'))
76 pending('no support for initdb with debian/ubuntu', :if => (node.facts['osfamily'] == 'Debian'))
78 # TODO: skip for ubuntu and centos 5
80 # Set global locale and charset option, and try installing postgres
85 class { 'postgresql::server': }
88 puppet_apply(pp) do |r|
89 # Currently puppetlabs/apt shows deprecated messages
90 #r.stderr.should be_empty
92 [2,6].should include(r.exit_code)
95 puppet_apply(pp) do |r|
96 # Currently puppetlabs/apt shows deprecated messages
97 #r.stderr.should be_empty
99 [0,4].should include(r.exit_code)
102 # Remove db first, if it exists for some reason
103 shell('su postgres -c "dropdb test1"')
104 shell('su postgres -c "createdb test1"')
105 shell('su postgres -c \'psql -c "show lc_ctype" test1\'') do |r|
106 r.stdout.should =~ /en_NG/
109 shell('su postgres -c \'psql -c "show lc_collate" test1\'') do |r|
110 r.stdout.should =~ /en_NG/