Thread: pg_rewind test could not run in 'remote' mode

pg_rewind test could not run in 'remote' mode

From
kingter wang
Date:
Logged by: Kingter Wang
Email address: kingter(at)gmail(dot)com
PostgreSQL version: 9.5
Operating system: RHEL 6.4 64bit
Description:

pg_rewind TAP tests always run in 'local' mode, even when specify test mode to 'remote’.

Symptom
========
See  pg_rewind test output on console:
The pg_rewind test still run in local mode, even when passed test mode as ‘remote’:

$cd src/bin/pg_rewind/
$make check
...
... prove -I ../../../src/test/perl/ --verbose t/*.pl :: local
t/001_basic.pl .......
1..4
ok 1 - pg_rewind local
...
...
All tests successful.
...
...prove -I ../../../src/test/perl/ --verbose t/*.pl :: remote
t/001_basic.pl .......
1..4
ok 1 - pg_rewind local
...

Analysis:
=======
The issue should be due to wrongly compare string for equality with '==' operator in perl script below.
In perl, to compare string for equality, should use 'eq' operator rather than '==' which used for 
compare equality of number. See details in perl document:http://perlmeme.org/howtos/syntax/comparing_values.html

src/bin/pg_rewind/RewindTest.pm:
sub run_pg_rewind
{
...
if ($test_mode == "local")
{
  ...
}
elsif ($test_mode == "remote")
{
...
}
}

attached a simple patch for fix the bug.

Note that, the pg_rewind tests "make check" will fail against ‘remote’ mode. 
Current ‘make check’ can pass is because the pg_rewind tests run the ‘local’ mode twice,
and  the ‘remote’ mode was not touched actually.

With the fix, the ‘make check’ will fail against ‘remote’ mode.
$make check
…prove -I ../../../src/test/perl/ --verbose t/*.pl :: remote
t/001_basic.pl .......
1..4
not ok 1 - pg_rewind remote

#   Failed test 'pg_rewind remote'
#   at RewindTest.pm line 236.
not ok 2 - table content: query result matches
not ok 3 - truncation: query result matches
….

Best Regards,
Kingter
   

Attachment

Re: pg_rewind test could not run in 'remote' mode

From
Michael Paquier
Date:
On Tue, Apr 7, 2015 at 5:34 PM, kingter wang <kingter@gmail.com> wrote:
> [...]
> Note that, the pg_rewind tests "make check" will fail against 'remote' mode.
> Current 'make check' can pass is because the pg_rewind tests run the 'local'
> mode twice,
> and  the 'remote' mode was not touched actually.

Yes, we are aware of that. There are actually some other problems
lying around (remote command is not built correctly for example) and
they have already been reported here by Peter Eisentraut:
http://www.postgresql.org/message-id/5519F169.8030406@gmx.net
This thread has a patch as well...
Regards,
--
Michael

Re: pg_rewind test could not run in 'remote' mode

From
kingter wang
Date:
Thanks for the quick response Michael!

Yes, that's the same problem with reported in the thread mentioned above.

Regards,
Kingter

On Tue, Apr 7, 2015 at 4:51 PM, Michael Paquier <michael.paquier@gmail.com>
wrote:

> On Tue, Apr 7, 2015 at 5:34 PM, kingter wang <kingter@gmail.com> wrote:
> > [...]
> > Note that, the pg_rewind tests "make check" will fail against 'remote'
> mode.
> > Current 'make check' can pass is because the pg_rewind tests run the
> 'local'
> > mode twice,
> > and  the 'remote' mode was not touched actually.
>
> Yes, we are aware of that. There are actually some other problems
> lying around (remote command is not built correctly for example) and
> they have already been reported here by Peter Eisentraut:
> http://www.postgresql.org/message-id/5519F169.8030406@gmx.net
> This thread has a patch as well...
> Regards,
> --
> Michael
>