Re: [HACKERS] bug/oversight in TestLib.pm and PostgresNode.pm - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [HACKERS] bug/oversight in TestLib.pm and PostgresNode.pm
Date
Msg-id CAB7nPqRgFAOh3_0kZXKUCdbQzzSxnG4GvUOg4dM49cngtLHv-Q@mail.gmail.com
Whole thread Raw
In response to [HACKERS] bug/oversight in TestLib.pm and PostgresNode.pm  (Erik Rijkers <er@xs4all.nl>)
Responses Re: [HACKERS] bug/oversight in TestLib.pm and PostgresNode.pm  (Erik Rijkers <er@xs4all.nl>)
List pgsql-hackers
On Thu, Mar 23, 2017 at 12:51 AM, Erik Rijkers <er@xs4all.nl> wrote:
> While trying to test pgbench's stderr (looking for 'creating tables' in
> output of the initialisation step)  I ran into these two bugs (or perhaps
> better 'oversights').

+   if (defined $expected_stderr) {
+       like($stderr, $expected_stderr, "$test_name: stderr matches");
+   }
+   else {   is($stderr, '', "$test_name: no stderr");
-   like($stdout, $expected_stdout, "$test_name: matches");
+   }
To simplify that you could as well set expected_output to be an empty
string, and just use like() instead of is(), saving this if/else.

> But especially the omission of command_fails_like() in PostgresNode.pm feels
> like an bug.

+=item $node->command_fails_like(...) - TestLib::command_fails_like
with our PGPORT
+
+See command_ok(...)
+
+=cut
+
+sub command_fails_like
+{
+   my $self = shift;
+
+   local $ENV{PGPORT} = $self->port;
+
+   TestLib::command_fails_like(@_);
+}
Most likely a case where this is needed has not showed up, so +1 to
remove this inconsistency across the modules.
-- 
Michael



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: [HACKERS] Measuring replay lag
Next
From: Amit Kapila
Date:
Subject: Re: [HACKERS] pageinspect and hash indexes