Using Test::More test functions for pg_rewind

Started by Daniel Gustafssonabout 4 years ago3 messageshackers
Jump to latest
#1Daniel Gustafsson
daniel@yesql.se

check_query() in RewindTest.pm currently has this comment before handrolling
tests for return code and stderr:

# We don't use ok() for the exit code and stderr, because we want this
# check to be just a single test.

The code came with the initial import of pg_rewind, and there is no further
explanation but I guess it was to make test planning easier since each
check_query would count as 1 test. (inspecting old pre-import pg_rewind repos
on Github didn't given any other insights). Does anymore remember the
rationale for this?

Since we moved to done_testing() with 549ec201d we no longer need be concerned
with test counts, so we can replace this with normal is() tests, as per the
attached, making the output in the errorpath consistent with other tests.
Unless I'm missing something important here.

--
Daniel Gustafsson https://vmware.com/

Attachments:

0001-Use-test-functions-in-pg_rewind-test-module.patchapplication/octet-stream; name=0001-Use-test-functions-in-pg_rewind-test-module.patch; x-unix-mode=0644Download+4-16
#2Andrew Dunstan
andrew@dunslane.net
In reply to: Daniel Gustafsson (#1)
Re: Using Test::More test functions for pg_rewind

On 2/21/22 09:10, Daniel Gustafsson wrote:

check_query() in RewindTest.pm currently has this comment before handrolling
tests for return code and stderr:

# We don't use ok() for the exit code and stderr, because we want this
# check to be just a single test.

The code came with the initial import of pg_rewind, and there is no further
explanation but I guess it was to make test planning easier since each
check_query would count as 1 test. (inspecting old pre-import pg_rewind repos
on Github didn't given any other insights). Does anymore remember the
rationale for this?

Since we moved to done_testing() with 549ec201d we no longer need be concerned
with test counts, so we can replace this with normal is() tests, as per the
attached, making the output in the errorpath consistent with other tests.
Unless I'm missing something important here.

Looks OK. Now we require a sufficiently modern Test::More we could have
made it a subtest if necessary.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#3Daniel Gustafsson
daniel@yesql.se
In reply to: Andrew Dunstan (#2)
Re: Using Test::More test functions for pg_rewind

On 21 Feb 2022, at 16:17, Andrew Dunstan <andrew@dunslane.net> wrote:

Looks OK.

Thanks, pushed.

--
Daniel Gustafsson https://vmware.com/