Re: pg_checksum: add test for coverage

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Dong Wook Lee <sh95119(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_checksum: add test for coverage
Date: 2022-08-29 11:46:25
Message-ID: 2EFDD8CB-025E-48E0-8E69-E0D31FDF2025@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 29 Aug 2022, at 13:26, Dong Wook Lee <sh95119(at)gmail(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-08-29 11:50:09 Re: Make #else/#endif comments more consistent
Previous Message houzj.fnst@fujitsu.com 2022-08-29 11:31:49 RE: Perform streaming logical transactions by background workers and parallel apply