Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteef4a33

Browse files
committed
Add error pattern checks for some TAP tests for non-existing objects
Some tests are updated to use command_fails_like(), gaining a check forthe error output generated. The test changed in pg_amcheck has come upafter noticing that an incorrect option name still made the test topass, while the command failed. The three other tests changed insrc/bin/scripts/ have been noticed by me, in passing.Author: Dagfinn Ilmari Mannsåker, Michael PaquierDiscussion:https://postgr.es/m/87bjvy50cs.fsf@wibble.ilmari.org
1 parent858b4db commiteef4a33

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

‎src/bin/pg_amcheck/t/002_nonesuch.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@
8585
# Failing to connect to the initial database due to bad username is an error.
8686
$node->command_checks_all(
8787
['pg_amcheck','--username'=>'no_such_user','postgres' ],
88-
1, [qr/^$/], [],'checking with a non-existent user');
88+
1,
89+
[qr/^$/],
90+
[qr/role "no_such_user" does not exist/],
91+
'checking with a non-existent user');
8992

9093
#########################################
9194
# Test checking databases without amcheck installed

‎src/bin/scripts/t/010_clusterdb.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
qr/statement: CLUSTER;/,
2222
'SQL CLUSTER run');
2323

24-
$node->command_fails(['clusterdb','--table'=>'nonexistent' ],
24+
$node->command_fails_like(
25+
['clusterdb','--table'=>'nonexistent' ],
26+
qr/relation "nonexistent" does not exist/,
2527
'fails with nonexistent table');
2628

2729
$node->safe_psql('postgres',

‎src/bin/scripts/t/050_dropdb.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
qr/statement: DROP DATABASE foobar2 WITH\(FORCE\);/,
2929
'SQL DROP DATABASE (FORCE) run');
3030

31-
$node->command_fails(['dropdb','nonexistent' ],
31+
$node->command_fails_like(
32+
['dropdb','nonexistent' ],
33+
qr/database "nonexistent" does not exist/,
3234
'fails with nonexistent database');
3335

3436
# check that invalid database can be dropped with dropdb

‎src/bin/scripts/t/070_dropuser.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
qr/statement: DROP ROLE regress_foobar1/,
2323
'SQL DROP ROLE run');
2424

25-
$node->command_fails(['dropuser','regress_nonexistent' ],
25+
$node->command_fails_like(
26+
['dropuser','regress_nonexistent' ],
27+
qr/role "regress_nonexistent" does not exist/,
2628
'fails with nonexistent user');
2729

2830
done_testing();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp