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

Commit8cd7627

Browse files
committed
psql: Add test for psql behavior on server crash
Author: Fabien COELHO <coelho@cri.ensmp.fr>Discussion:https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre
1 parentc14a9ee commit8cd7627

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎src/bin/psql/t/001_basic.pl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,21 @@ sub psql_fails_like
115115
qr/^Asynchronous notification "foo" with payload "bar" received from server process with PID\d+\.$/,
116116
'notification with payload');
117117

118+
# test behavior and output on server crash
119+
my ($ret,$out,$err) =$node->psql(
120+
'postgres',
121+
"SELECT 'before' AS running;\n" .
122+
"SELECT pg_terminate_backend(pg_backend_pid());\n" .
123+
"SELECT 'AFTER' AS not_running;\n");
124+
125+
is($ret, 2,'server crash: psql exit code');
126+
like($out,qr/before/,'server crash: output before crash');
127+
ok($out !~qr/AFTER/,'server crash: no output after crash');
128+
is($err,'psql:<stdin>:2: FATAL: terminating connection due to administrator command
129+
server closed the connection unexpectedly
130+
This probably means the server terminated abnormally
131+
before or while processing the request.
132+
psql:<stdin>:2: fatal: connection to server was lost',
133+
'server crash: error message');
134+
118135
done_testing();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp