v2-0001-Fix-buildfarm-test-failures-in-test_oat_hooks.patch
application/octet-stream
Filename: v2-0001-Fix-buildfarm-test-failures-in-test_oat_hooks.patch
Type: application/octet-stream
Part: 0
Message:
Re: New Object Access Type hooks
Patch
Format: format-patch
Series: patch v2-0001
Subject: Fix buildfarm test failures in test_oat_hooks
| File | + | − |
|---|---|---|
| src/test/modules/test_oat_hooks/expected/test_oat_hooks.out | 1 | 0 |
| src/test/modules/test_oat_hooks/Makefile | 0 | 3 |
| src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql | 1 | 0 |
| src/test/modules/test_oat_hooks/test_oat_hooks.c | 2 | 10 |
| src/test/modules/test_oat_hooks/test_oat_hooks.conf | 0 | 1 |
From 862e79a913de8754c7d4523e2495ba703da25c4e Mon Sep 17 00:00:00 2001
From: Mark Dilger <mark.dilger@enterprisedb.com>
Date: Tue, 22 Mar 2022 09:46:32 -0700
Subject: [PATCH v2] Fix buildfarm test failures in test_oat_hooks
---
src/test/modules/test_oat_hooks/Makefile | 3 ---
.../test_oat_hooks/expected/test_oat_hooks.out | 1 +
.../modules/test_oat_hooks/sql/test_oat_hooks.sql | 1 +
src/test/modules/test_oat_hooks/test_oat_hooks.c | 12 ++----------
src/test/modules/test_oat_hooks/test_oat_hooks.conf | 1 -
5 files changed, 4 insertions(+), 14 deletions(-)
delete mode 100644 src/test/modules/test_oat_hooks/test_oat_hooks.conf
diff --git a/src/test/modules/test_oat_hooks/Makefile b/src/test/modules/test_oat_hooks/Makefile
index d0df9c1abb..d03ef2caf1 100644
--- a/src/test/modules/test_oat_hooks/Makefile
+++ b/src/test/modules/test_oat_hooks/Makefile
@@ -7,9 +7,6 @@ OBJS = \
PGFILEDESC = "test_oat_hooks - example use of object access hooks"
REGRESS = test_oat_hooks
-REGRESS_OPTS = --temp-config=$(top_srcdir)/src/test/modules/test_oat_hooks/test_oat_hooks.conf
-# Disabled because these tests require "shared_preload_libraries=test_oat_hooks",
-# which typical installcheck users do not have (e.g. buildfarm clients).
NO_INSTALLCHECK = 1
ifdef USE_PGXS
diff --git a/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out b/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
index 2035769580..4192a2fb49 100644
--- a/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
+++ b/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
@@ -2,6 +2,7 @@
-- object_access_hook_str. Since the auditing GUC starts out false, we miss the
-- initial "attempting" audit message from the ProcessUtility_hook, but we
-- should thereafter see the audit messages
+LOAD 'test_oat_hooks';
SET test_oat_hooks.audit = true;
NOTICE: in object_access_hook_str: superuser attempting alter (set) [test_oat_hooks.audit]
NOTICE: in object_access_hook_str: superuser finished alter (set) [test_oat_hooks.audit]
diff --git a/src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql b/src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
index 5fb3a2f0ea..7c38202782 100644
--- a/src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
+++ b/src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
@@ -2,6 +2,7 @@
-- object_access_hook_str. Since the auditing GUC starts out false, we miss the
-- initial "attempting" audit message from the ProcessUtility_hook, but we
-- should thereafter see the audit messages
+LOAD 'test_oat_hooks';
SET test_oat_hooks.audit = true;
-- Create objects for use in the test
diff --git a/src/test/modules/test_oat_hooks/test_oat_hooks.c b/src/test/modules/test_oat_hooks/test_oat_hooks.c
index b1709f4d63..b50567749c 100644
--- a/src/test/modules/test_oat_hooks/test_oat_hooks.c
+++ b/src/test/modules/test_oat_hooks/test_oat_hooks.c
@@ -13,6 +13,7 @@
#include "postgres.h"
+#include "access/parallel.h"
#include "catalog/dependency.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_proc.h"
@@ -68,15 +69,6 @@ void _PG_fini(void);
void
_PG_init(void)
{
- /*
- * We allow to load the Object Access Type test module on single-user-mode
- * or shared_preload_libraries settings only.
- */
- if (IsUnderPostmaster)
- ereport(ERROR,
- (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
- errmsg("test_oat_hooks must be loaded via shared_preload_libraries")));
-
/*
* test_oat_hooks.deny_set_variable = (on|off)
*/
@@ -200,7 +192,7 @@ _PG_fini(void)
static void
emit_audit_message(const char *type, const char *hook, char *action, char *objName)
{
- if (REGRESS_audit)
+ if (REGRESS_audit && !IsParallelWorker())
{
const char *who = superuser_arg(GetUserId()) ? "superuser" : "non-superuser";
diff --git a/src/test/modules/test_oat_hooks/test_oat_hooks.conf b/src/test/modules/test_oat_hooks/test_oat_hooks.conf
deleted file mode 100644
index a44cbdd4a4..0000000000
--- a/src/test/modules/test_oat_hooks/test_oat_hooks.conf
+++ /dev/null
@@ -1 +0,0 @@
-shared_preload_libraries = test_oat_hooks
--
2.35.1