summaryrefslogtreecommitdiffstats
path: root/src/bin/scripts/t/040_createuser.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
commit6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch)
tree657d8194422a5daccecfd42d654b8a245ef7b4c8 /src/bin/scripts/t/040_createuser.pl
parentInitial commit. (diff)
downloadpostgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.tar.xz
postgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.zip
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bin/scripts/t/040_createuser.pl')
-rw-r--r--src/bin/scripts/t/040_createuser.pl34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl
new file mode 100644
index 0000000..916d925
--- /dev/null
+++ b/src/bin/scripts/t/040_createuser.pl
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+
+use PostgresNode;
+use TestLib;
+use Test::More tests => 17;
+
+program_help_ok('createuser');
+program_version_ok('createuser');
+program_options_handling_ok('createuser');
+
+my $node = get_new_node('main');
+$node->init;
+$node->start;
+
+$node->issues_sql_like(
+ [ 'createuser', 'regress_user1' ],
+ qr/statement: CREATE ROLE regress_user1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;/,
+ 'SQL CREATE USER run');
+$node->issues_sql_like(
+ [ 'createuser', '-L', 'regress_role1' ],
+ qr/statement: CREATE ROLE regress_role1 NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT NOLOGIN;/,
+ 'create a non-login role');
+$node->issues_sql_like(
+ [ 'createuser', '-r', 'regress_user2' ],
+ qr/statement: CREATE ROLE regress_user2 NOSUPERUSER NOCREATEDB CREATEROLE INHERIT LOGIN;/,
+ 'create a CREATEROLE user');
+$node->issues_sql_like(
+ [ 'createuser', '-s', 'regress_user3' ],
+ qr/statement: CREATE ROLE regress_user3 SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;/,
+ 'create a superuser');
+
+$node->command_fails([ 'createuser', 'regress_user1' ],
+ 'fails if role already exists');