pg_checksum: add test for coverage
Hi,
I add a tiny test to pg_checksum for coverage.
I checked it improve test coverage 77.9% -> 87.7%.
---
Regards,
DongWook Lee.
Attachments:
v1_add_test_to_pg_checksum.patchapplication/octet-stream; name=v1_add_test_to_pg_checksum.patchDownload
From 59b97fe48ff987f4856df04939d016f829a2c54e Mon Sep 17 00:00:00 2001
From: Lee Dong Wook <sh95119@gmail.com>
Date: Tue, 23 Aug 2022 11:50:28 +0900
Subject: [PATCH] pg_checksum: add test for coverage
---
src/bin/pg_checksums/t/002_actions.pl | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl
index 0309cbbaa330..228fcdd63c59 100644
--- a/src/bin/pg_checksums/t/002_actions.pl
+++ b/src/bin/pg_checksums/t/002_actions.pl
@@ -163,6 +163,16 @@ sub check_relation_corruption
[ 'pg_checksums', '-D', $pgdata ],
"verifies checksums as default action");
+# 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");
+
# Specific relation files cannot be requested when action is --disable
# or --enable.
command_fails(
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/
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