Thread: pg_checksum: add test for coverage

pg_checksum: add test for coverage

From
Dong Wook Lee
Date:
Hi,
I add a tiny test to pg_checksum for coverage.
I checked it improve test coverage 77.9% -> 87.7%.

---
Regards,
DongWook Lee.

Attachment

Re: pg_checksum: add test for coverage

From
Daniel Gustafsson
Date:
> On 29 Aug 2022, at 13:26, Dong Wook Lee <sh95119@gmail.com> wrote:

> I add a tiny test to pg_checksum for coverage.
> I checked it improve test coverage 77.9% -> 87.7%.

+# Checksums are verified if --progress arguments are specified
+command_ok(
+    [ 'pg_checksums', '--progress', '-D', $pgdata ],
+    "verifies checksums as default action with --progress option");
+
+# Checksums are verified if --verbose arguments are specified
+command_ok(
+    [ 'pg_checksums', '--verbose', '-D', $pgdata ],
+    "verifies checksums as default action with --verbose option");

This isn't really true, --progress or --verbose doesn't enable checksum
verification, it just happens to be the default and thus is invoked when called
without a mode parameter.

As written these tests aren't providing more coverage, they run more code but
they don't ensure that the produced output is correct.  If you write these
tests with validation on the output they will be a lot more interesting.

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




Re: pg_checksum: add test for coverage

From
Michael Paquier
Date:
On Mon, Aug 29, 2022 at 01:46:25PM +0200, Daniel Gustafsson wrote:
> As written these tests aren't providing more coverage, they run more code but
> they don't ensure that the produced output is correct.  If you write these
> tests with validation on the output they will be a lot more interesting.

DongWook, if you are able to reply back to this feedback, please feel
free to send a new patch.  For now, I have marked this CF entry as
returned with feedback.
--
Michael

Attachment