Skip to content

Commit 0daf411

Browse files
committed
Add an acceptance test to prove that default encoding is wrong on Debian
1 parent b0f2a8f commit 0daf411

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require 'spec_helper_acceptance'
2+
3+
# These tests are designed to ensure that the module, when ran with defaults,
4+
# sets up everything correctly and allows us to connect to Postgres.
5+
describe 'postgres::server', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
6+
it 'with defaults' do
7+
pp = <<-EOS
8+
class { 'postgresql::globals':
9+
encoding => 'UTF8',
10+
locale => 'en_NG',
11+
} ->
12+
class { 'postgresql::server': }
13+
EOS
14+
15+
apply_manifest(pp, :catch_failures => true)
16+
apply_manifest(pp, :catch_changes => true)
17+
end
18+
19+
describe port(5432) do
20+
it { is_expected.to be_listening }
21+
end
22+
23+
it 'can connect with psql' do
24+
psql('--command="\l" postgres', 'postgres') do |r|
25+
expect(r.stdout).to match(/List of databases/)
26+
end
27+
end
28+
29+
it 'must set UTF8 as template1 encoding' do
30+
psql('--command="SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname=\'template1\'"') do |r|
31+
expect(r.stdout).to match(/UTF8/)
32+
end
33+
end
34+
end
35+
36+
37+

0 commit comments

Comments
 (0)