| 1 |
|
| 2 |
# Copyright (c) 2021-2025, PostgreSQL Global Development Group |
| 3 |
|
| 4 |
use strict; |
| 5 |
use warnings FATAL => 'all'; |
| 6 |
|
| 7 |
use PostgreSQL::Test::Cluster; |
| 8 |
use PostgreSQL::Test::Utils; |
| 9 |
use Test::More; |
| 10 |
|
| 11 |
program_help_ok('dropuser'); |
| 12 |
program_version_ok('dropuser'); |
| 13 |
program_options_handling_ok('dropuser'); |
| 14 |
|
| 15 |
my $node = PostgreSQL::Test::Cluster->new('main'); |
| 16 |
$node->init; |
| 17 |
$node->start; |
| 18 |
|
| 19 |
$node->safe_psql('postgres', 'CREATE ROLE regress_foobar1'); |
| 20 |
$node->issues_sql_like( |
| 21 |
[ 'dropuser', 'regress_foobar1' ], |
| 22 |
qr/statement: DROP ROLE regress_foobar1/, |
| 23 |
'SQL DROP ROLE run'); |
| 24 |
|
| 25 |
$node->command_fails_like( |
| 26 |
[ 'dropuser', 'regress_nonexistent' ], |
| 27 |
qr/role "regress_nonexistent" does not exist/, |
| 28 |
'fails with nonexistent user'); |
| 29 |
|
| 30 |
done_testing(); |