Add PostgresNode::command_fails_like()
authorMichael Paquier <michael@paquier.xyz>
Wed, 1 Sep 2021 01:28:01 +0000 (10:28 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 1 Sep 2021 01:28:01 +0000 (10:28 +0900)
This is useful to test for a command failure with some default
connection parameters associated to a node, in combination with checks
on error patterns expected.  This routine will be used by an upcoming
future patch, but could be also plugged into some of the existing
tests.

Extracted from a larger patch by the same author.

Author: Ronan Dunklau
Discussion: https://postgr.es/m/5742739.ga3mSNWIix@aivenronan

src/test/perl/PostgresNode.pm

index 8158ea5b2f5cb98f486f59eb9482a229cbced19a..c59da758c7ee9a4c62dd633bef1e8bc4bbea0f91 100644 (file)
@@ -2267,6 +2267,26 @@ sub command_like
 
 =pod
 
+=item $node->command_fails_like(...)
+
+TestLib::command_fails_like with our connection parameters. See command_ok(...)
+
+=cut
+
+sub command_fails_like
+{
+   local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+   my $self = shift;
+
+   local %ENV = $self->_get_env();
+
+   TestLib::command_fails_like(@_);
+   return;
+}
+
+=pod
+
 =item $node->command_checks_all(...)
 
 TestLib::command_checks_all with our connection parameters. See