Subscription tests vs log_error_verbosity

Started by Andrew Dunstanover 3 years ago3 messages
#1Andrew Dunstan
andrew@dunslane.net
1 attachment(s)

I have just got to the bottom of why the new subscription tests
027_nosuperuser.pl and 029_on_error.pl have been failing for me - it's
because my test setup has log_error_verbosity set to 'verbose'. Either
we should force log_error_verbosity to 'default' for these tests, or we
should make the regexes we're testing for more forgiving as in the attached.

cheers

andrew

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

Attachments:

fix-subscription-tests-verbose-errors.patchtext/x-patch; charset=UTF-8; name=fix-subscription-tests-verbose-errors.patchDownload
diff --git a/src/test/subscription/t/027_nosuperuser.pl b/src/test/subscription/t/027_nosuperuser.pl
index 350bc40efc..96ec23aab7 100644
--- a/src/test/subscription/t/027_nosuperuser.pl
+++ b/src/test/subscription/t/027_nosuperuser.pl
@@ -179,7 +179,7 @@ revoke_superuser("regress_admin");
 publish_update("alice.unpartitioned", 5 => 9);
 expect_failure(
 	"alice.unpartitioned", 2, 5, 7,
-	qr/ERROR:  permission denied for table unpartitioned/msi,
+	qr/ERROR: ( [A-Z0-9]+:)? permission denied for table unpartitioned/msi,
 	"non-superuser admin fails to replicate update");
 grant_superuser("regress_admin");
 expect_replication("alice.unpartitioned", 2, 7, 9,
@@ -214,7 +214,7 @@ expect_failure(
 	3,
 	7,
 	11,
-	qr/ERROR:  permission denied for table unpartitioned/msi,
+	qr/ERROR: ( [A-Z0-9]+:)? permission denied for table unpartitioned/msi,
 	"non-superuser admin without SELECT privileges fails to replicate update"
 );
 
@@ -262,7 +262,7 @@ expect_failure(
 	2,
 	11,
 	13,
-	qr/ERROR:  "regress_admin" cannot replicate into relation with row-level security enabled: "unpartitioned\w*"/msi,
+	qr/ERROR: ( [A-Z0-9]+:)? "regress_admin" cannot replicate into relation with row-level security enabled: "unpartitioned\w*"/msi,
 	"non-superuser admin fails to replicate insert into rls enabled table");
 grant_superuser("regress_admin");
 expect_replication("alice.unpartitioned", 3, 11, 15,
@@ -276,7 +276,7 @@ expect_failure(
 	3,
 	11,
 	15,
-	qr/ERROR:  "regress_admin" cannot replicate into relation with row-level security enabled: "unpartitioned\w*"/msi,
+	qr/ERROR: ( [A-Z0-9]+:)? "regress_admin" cannot replicate into relation with row-level security enabled: "unpartitioned\w*"/msi,
 	"non-superuser admin fails to replicate update into rls enabled unpartitioned"
 );
 
@@ -291,7 +291,7 @@ expect_failure(
 	3,
 	13,
 	17,
-	qr/ERROR:  "regress_admin" cannot replicate into relation with row-level security enabled: "unpartitioned\w*"/msi,
+	qr/ERROR: ( [A-Z0-9]+:)? "regress_admin" cannot replicate into relation with row-level security enabled: "unpartitioned\w*"/msi,
 	"non-superuser admin without bypassrls fails to replicate delete into rls enabled unpartitioned"
 );
 grant_bypassrls("regress_admin");
diff --git a/src/test/subscription/t/029_on_error.pl b/src/test/subscription/t/029_on_error.pl
index e8b904b745..303e8ec3fc 100644
--- a/src/test/subscription/t/029_on_error.pl
+++ b/src/test/subscription/t/029_on_error.pl
@@ -48,7 +48,7 @@ sub test_skip_lsn
 	# Check the log to ensure that the transaction is skipped, and advance the
 	# offset of the log file for the next test.
 	$offset = $node_subscriber->wait_for_log(
-		qr/LOG:  done skipping logical replication transaction finished at $lsn/,
+		qr/LOG: ( [A-Z0-9]+:)? done skipping logical replication transaction finished at $lsn/,
 		$offset);
 
 	# Insert non-conflict data
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: Subscription tests vs log_error_verbosity

Andrew Dunstan <andrew@dunslane.net> writes:

I have just got to the bottom of why the new subscription tests
027_nosuperuser.pl and 029_on_error.pl have been failing for me - it's
because my test setup has log_error_verbosity set to 'verbose'. Either
we should force log_error_verbosity to 'default' for these tests, or we
should make the regexes we're testing for more forgiving as in the attached.

+1 for the second answer. I don't like forcing parameter settings
that we don't absolutely have to --- it reduces our test coverage.
(Admittedly, changing log_error_verbosity in particular is probably
not giving up much coverage, but as a general principle it's bad.)

regards, tom lane

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#2)
Re: Subscription tests vs log_error_verbosity

On 2022-06-11 Sa 14:52, Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

I have just got to the bottom of why the new subscription tests
027_nosuperuser.pl and 029_on_error.pl have been failing for me - it's
because my test setup has log_error_verbosity set to 'verbose'. Either
we should force log_error_verbosity to 'default' for these tests, or we
should make the regexes we're testing for more forgiving as in the attached.

+1 for the second answer. I don't like forcing parameter settings
that we don't absolutely have to --- it reduces our test coverage.
(Admittedly, changing log_error_verbosity in particular is probably
not giving up much coverage, but as a general principle it's bad.)

Yeah, Done that way.

cheers

andrew

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