You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/acceptance/server/grant_role_spec.rb
+21-27
Original file line number
Diff line number
Diff line change
@@ -157,42 +157,36 @@ class { 'postgresql::server': }
157
157
end
158
158
159
159
it'grants a role to a user/superuser'do
160
-
begin
161
-
idempotent_apply(pp_one)
162
-
163
-
## Check that the role was granted to the user
164
-
psql('--command="SELECT 1 WHERE pg_has_role(\'psql_grant_role_tester\', \'test_group\', \'MEMBER\') = true" grant_role_test','psql_grant_role_tester')do |r|
165
-
expect(r.stdout).tomatch(%r{\(1 row\)})
166
-
expect(r.stderr).toeq('')
167
-
end
168
-
## Check that the role was granted to the user
169
-
psql('--command="SELECT 1 FROM pg_roles AS r_role JOIN pg_auth_members AS am ON r_role.oid = am.member JOIN pg_roles AS r_group ON r_group.oid = am.roleid WHERE r_group.rolname = \'test_group\' AND r_role.rolname = \'psql_grant_role_tester\'" grant_role_test','psql_grant_role_tester')do |r| # rubocop:disable Metrics/LineLength
170
-
expect(r.stdout).tomatch(%r{\(1 row\)})
171
-
expect(r.stderr).toeq('')
172
-
end
160
+
idempotent_apply(pp_one)
161
+
162
+
## Check that the role was granted to the user
163
+
psql('--command="SELECT 1 WHERE pg_has_role(\'psql_grant_role_tester\', \'test_group\', \'MEMBER\') = true" grant_role_test','psql_grant_role_tester')do |r|
164
+
expect(r.stdout).tomatch(%r{\(1 row\)})
165
+
expect(r.stderr).toeq('')
166
+
end
167
+
## Check that the role was granted to the user
168
+
psql('--command="SELECT 1 FROM pg_roles AS r_role JOIN pg_auth_members AS am ON r_role.oid = am.member JOIN pg_roles AS r_group ON r_group.oid = am.roleid WHERE r_group.rolname = \'test_group\' AND r_role.rolname = \'psql_grant_role_tester\'" grant_role_test','psql_grant_role_tester')do |r| # rubocop:disable Layout/LineLength
169
+
expect(r.stdout).tomatch(%r{\(1 row\)})
170
+
expect(r.stderr).toeq('')
173
171
end
174
172
end
175
173
176
174
it'revokes a role from a user'do
177
-
begin
178
-
apply_manifest(pp_two,catch_failures: true)
179
-
apply_manifest(pp_two,expect_changes: true)
180
-
181
-
psql('--command="SELECT 1 WHERE pg_has_role(\'psql_grant_role_tester\', \'test_group\', \'MEMBER\') = true" grant_role_test','psql_grant_role_tester')do |r|
182
-
expect(r.stdout).tomatch(%r{\(0 rows\)})
183
-
expect(r.stderr).toeq('')
184
-
end
175
+
apply_manifest(pp_two,catch_failures: true)
176
+
apply_manifest(pp_two,expect_changes: true)
177
+
178
+
psql('--command="SELECT 1 WHERE pg_has_role(\'psql_grant_role_tester\', \'test_group\', \'MEMBER\') = true" grant_role_test','psql_grant_role_tester')do |r|
179
+
expect(r.stdout).tomatch(%r{\(0 rows\)})
180
+
expect(r.stderr).toeq('')
185
181
end
186
182
end
187
183
188
184
it'does not grant permission to a nonexistent user'do
189
-
begin
190
-
apply_manifest(pp_three,expect_failures: true)
185
+
apply_manifest(pp_three,expect_failures: true)
191
186
192
-
psql('--command="SELECT 1 WHERE pg_has_role(\'psql_grant_role_tester\', \'test_group\', \'MEMBER\') = true" grant_role_test','psql_grant_role_tester')do |r|
193
-
expect(r.stdout).tomatch(%r{\(0 rows\)})
194
-
expect(r.stderr).toeq('')
195
-
end
187
+
psql('--command="SELECT 1 WHERE pg_has_role(\'psql_grant_role_tester\', \'test_group\', \'MEMBER\') = true" grant_role_test','psql_grant_role_tester')do |r|
0 commit comments