mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Fix role names in src/test/authentication/t/005_login_trigger.pl
Per buildfarm member longfin.
This commit is contained in:
parent
20b7708662
commit
47ab5d2e2e
@ -94,8 +94,8 @@ $node->start;
|
|||||||
|
|
||||||
# Create temporary roles and log table
|
# Create temporary roles and log table
|
||||||
psql_command(
|
psql_command(
|
||||||
$node, 'CREATE ROLE alice WITH LOGIN;
|
$node, 'CREATE ROLE regress_alice WITH LOGIN;
|
||||||
CREATE ROLE mallory WITH LOGIN;
|
CREATE ROLE regress_mallory WITH LOGIN;
|
||||||
CREATE TABLE user_logins(id serial, who text);
|
CREATE TABLE user_logins(id serial, who text);
|
||||||
GRANT SELECT ON user_logins TO public;
|
GRANT SELECT ON user_logins TO public;
|
||||||
', 0, 'create tmp objects',
|
', 0, 'create tmp objects',
|
||||||
@ -109,7 +109,7 @@ psql_command(
|
|||||||
'CREATE FUNCTION on_login_proc() RETURNS event_trigger AS $$
|
'CREATE FUNCTION on_login_proc() RETURNS event_trigger AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
INSERT INTO user_logins (who) VALUES (SESSION_USER);
|
INSERT INTO user_logins (who) VALUES (SESSION_USER);
|
||||||
IF SESSION_USER = \'mallory\' THEN
|
IF SESSION_USER = \'regress_mallory\' THEN
|
||||||
RAISE EXCEPTION \'Hello %! You are NOT welcome here!\', SESSION_USER;
|
RAISE EXCEPTION \'Hello %! You are NOT welcome here!\', SESSION_USER;
|
||||||
END IF;
|
END IF;
|
||||||
RAISE NOTICE \'Hello %! You are welcome!\', SESSION_USER;
|
RAISE NOTICE \'Hello %! You are welcome!\', SESSION_USER;
|
||||||
@ -140,20 +140,20 @@ psql_command(
|
|||||||
|
|
||||||
# Try to log as allowed Alice and disallowed Mallory (two times)
|
# Try to log as allowed Alice and disallowed Mallory (two times)
|
||||||
psql_command(
|
psql_command(
|
||||||
$node, 'SELECT 1;', 0, 'try alice',
|
$node, 'SELECT 1;', 0, 'try regress_alice',
|
||||||
connstr => 'user=alice',
|
connstr => 'user=regress_alice',
|
||||||
log_exact => '1',
|
log_exact => '1',
|
||||||
err_like => [qr/You are welcome/],
|
err_like => [qr/You are welcome/],
|
||||||
err_unlike => [qr/You are NOT welcome/]);
|
err_unlike => [qr/You are NOT welcome/]);
|
||||||
psql_command(
|
psql_command(
|
||||||
$node, 'SELECT 1;', 2, 'try mallory',
|
$node, 'SELECT 1;', 2, 'try regress_mallory',
|
||||||
connstr => 'user=mallory',
|
connstr => 'user=regress_mallory',
|
||||||
log_exact => '',
|
log_exact => '',
|
||||||
err_like => [qr/You are NOT welcome/],
|
err_like => [qr/You are NOT welcome/],
|
||||||
err_unlike => [qr/You are welcome/]);
|
err_unlike => [qr/You are welcome/]);
|
||||||
psql_command(
|
psql_command(
|
||||||
$node, 'SELECT 1;', 2, 'try mallory',
|
$node, 'SELECT 1;', 2, 'try regress_mallory',
|
||||||
connstr => 'user=mallory',
|
connstr => 'user=regress_mallory',
|
||||||
log_exact => '',
|
log_exact => '',
|
||||||
err_like => [qr/You are NOT welcome/],
|
err_like => [qr/You are NOT welcome/],
|
||||||
err_unlike => [qr/You are welcome/]);
|
err_unlike => [qr/You are welcome/]);
|
||||||
@ -161,8 +161,8 @@ psql_command(
|
|||||||
# Check that Alice's login record is here, while the Mallory's one is not
|
# Check that Alice's login record is here, while the Mallory's one is not
|
||||||
psql_command(
|
psql_command(
|
||||||
$node, 'SELECT * FROM user_logins;', 0, 'select *',
|
$node, 'SELECT * FROM user_logins;', 0, 'select *',
|
||||||
log_like => [qr/3\|alice/],
|
log_like => [qr/3\|regress_alice/],
|
||||||
log_unlike => [qr/mallory/],
|
log_unlike => [qr/regress_mallory/],
|
||||||
err_like => [qr/You are welcome/]);
|
err_like => [qr/You are welcome/]);
|
||||||
|
|
||||||
# Check total number of successful logins so far
|
# Check total number of successful logins so far
|
||||||
@ -180,8 +180,8 @@ psql_command(
|
|||||||
psql_command(
|
psql_command(
|
||||||
$node, 'DROP TABLE user_logins;
|
$node, 'DROP TABLE user_logins;
|
||||||
DROP FUNCTION on_login_proc;
|
DROP FUNCTION on_login_proc;
|
||||||
DROP ROLE mallory;
|
DROP ROLE regress_mallory;
|
||||||
DROP ROLE alice;
|
DROP ROLE regress_alice;
|
||||||
', 0, 'cleanup',
|
', 0, 'cleanup',
|
||||||
log_exact => '',
|
log_exact => '',
|
||||||
err_exact => '');
|
err_exact => '');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user