-
Notifications
You must be signed in to change notification settings - Fork 611
/
Copy pathreassign_owned_by_spec.rb
36 lines (29 loc) · 1 KB
/
reassign_owned_by_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true
require 'spec_helper'
describe 'postgresql::server::reassign_owned_by' do
include_examples 'Debian 11'
let :title do
'test'
end
let :params do
{
db: 'test',
old_role: 'test_old_role',
new_role: 'test_new_role'
}
end
let :pre_condition do
<<-MANIFEST
class {'postgresql::server':}
postgresql::server::role{ ['test_old_role','test_new_role']: }
MANIFEST
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_postgresql__server__reassign_owned_by('test') }
it {
expect(subject).to contain_postgresql_psql('reassign_owned_by:test:REASSIGN OWNED BY "test_old_role" TO "test_new_role"')
.with_command('REASSIGN OWNED BY "test_old_role" TO "test_new_role"')
.with_onlyif(%r{SELECT tablename FROM pg_catalog.pg_tables WHERE\s*schemaname NOT IN \('pg_catalog', 'information_schema'\) AND\s*tableowner = 'test_old_role'.*}m)
.that_requires('Service[postgresqld_instance_main]')
}
end