File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff 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+
118135done_testing();
You can’t perform that action at this time.
0 commit comments