Skip to content

Commit b26a4cc

Browse files
committed
Add unit test for role with DBVERSION in connect_settings
1 parent 8bc7bad commit b26a4cc

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

spec/acceptance/server/role_spec.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper_acceptance'
4+
5+
describe 'postgresql::server::role' do
6+
let(:user) { 'foo' }
7+
let(:password) { 'bar' }
8+
9+
it 'with different DBVERSION in connect_settings' do
10+
pp_role = <<-MANIFEST
11+
$user = '#{user}'
12+
$password = '#{password}'
13+
14+
class { 'postgresql::server': }
15+
16+
postgresql::server::role { $user:
17+
password_hash => $password,
18+
connect_settings => {
19+
'DBVERSION' => '13',
20+
},
21+
}
22+
MANIFEST
23+
24+
if Gem::Version.new(postgresql_version) >= Gem::Version.new('14')
25+
idempotent_apply(pp_role)
26+
27+
# verify that password_encryption selectio is based on 'DBVERSION' and not on postgresql::serverglobals::version
28+
psql("--command=\"SELECT 1 FROM pg_shadow WHERE usename = '#{user}' AND passwd = 'md596948aad3fcae80c08a35c9b5958cd89'\"") do |r|
29+
expect(r.stdout).to match(%r{\(1 row\)})
30+
expect(r.stderr).to eq('')
31+
end
32+
end
33+
end
34+
end

0 commit comments

Comments
 (0)