v32-0010-Add-issues_sql_unlike-opposite-of-issues_sql_lik.patch

text/x-patch

Filename: v32-0010-Add-issues_sql_unlike-opposite-of-issues_sql_lik.patch
Type: text/x-patch
Part: 8
Message: Re: Statistics Import and Export

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v32-0010
Subject: Add issues_sql_unlike, opposite of issues_sql_like
File+
src/test/perl/PostgreSQL/Test/Cluster.pm 25 0
From 7e9a2903285f9f49a5434af6c2ab4337a158883d Mon Sep 17 00:00:00 2001
From: Corey Huinker <corey.huinker@gmail.com>
Date: Thu, 7 Nov 2024 18:06:52 -0500
Subject: [PATCH v32 10/14] Add issues_sql_unlike, opposite of issues_sql_like

This is the same as issues_sql_like(), but the specified text is
prohibited from being in the output rather than required.

This became necessary to test that a command-line filter was in fact
filtering out certain output that a prior test required.
---
 src/test/perl/PostgreSQL/Test/Cluster.pm | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 508e5e3917..1281071479 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -2799,6 +2799,31 @@ sub issues_sql_like
 }
 
 =pod
+=item $node->issues_sql_unlike(cmd, prohibited_sql, test_name)
+
+Run a command on the node, then verify that $prohibited_sql does not appear
+in the server log file.
+
+=cut
+
+sub issues_sql_unlike
+{
+	local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+	my ($self, $cmd, $prohibited_sql, $test_name) = @_;
+
+	local %ENV = $self->_get_env();
+
+	my $log_location = -s $self->logfile;
+
+	my $result = PostgreSQL::Test::Utils::run_log($cmd);
+	ok($result, "@$cmd exit code 0");
+	my $log =
+	  PostgreSQL::Test::Utils::slurp_file($self->logfile, $log_location);
+	unlike($log, $prohibited_sql, "$test_name: SQL found in server log");
+	return;
+}
+
 
 =item $node->log_content()
 
-- 
2.47.0