Skip to content

Commit

Permalink
directory_table: matchignore & remove meta-command username output
Browse files Browse the repository at this point in the history
PROBLEM

* If a developer runs the `directory_table` test suite using a
  non-gpadmin account, a diff will be encountered. The `\dY`
  meta-command output and NOTICE|DETAIL|ERROR output contained
  `gpadmin` hardcoded values.

CORRECTIVE ACTION

* As they introduce the username of the active user account running
  the tests, remove '\dY' (List of relations) meta-commands.
  Subsequent SQL commands exist which validate similar
  output (e.g. display row counts) .

* Update the pg_regress init_file to include matchignore entries to
  ignore the usernames in storage user mapping NOTICE, DETAIL & ERROR
  messages.
  • Loading branch information
eespino authored and my-ship-it committed Jun 11, 2024
1 parent c34727a commit 6678582
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 72 deletions.
5 changes: 5 additions & 0 deletions src/test/regress/init_file
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ m/^WARNING: table ".*" contains rows in segment .*, which is outside the # of s
# The following output is generated by \d on foreign tables, so ignore it.
m/Distributed by: \(.*\)/
m/Distributed randomly/

# directory_table test output is sensitive to the user running the tests
m/^NOTICE:.*storage user mapping for .* does not exist for storage server/
m/^DETAIL:.*storage server of storage user mapping for .* on storage server/
m/^(?:ERROR|NOTICE):.*storage user mapping for .* already exists for storage server/
-- end_matchignore

-- start_matchsubs
Expand Down
4 changes: 0 additions & 4 deletions src/test/regress/input/directory_table.source
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,12 @@ CREATE DIRECTORY TABLE IF NOT EXISTS dir_table2 TABLESPACE directory_tblspc;
CREATE DIRECTORY TABLE dir_table5 TABLESPACE directory_tblspc;
CREATE DIRECTORY TABLE dir_table6 TABLESPACE pg_default;

\dY
SELECT count(*) FROM pg_directory_table;
SELECT relname, relisshared, relpersistence, relkind FROM pg_class WHERE relname like '%dir_table%' ORDER BY 1;
\d+ dir_table1;
\d+ dir_table2;
\d+ dir_table3;
\c dirtable_db
\dY
SELECT count(*) FROM pg_directory_table;
SELECT relname, relisshared, relpersistence, relkind FROM pg_class WHERE relname like '%dir_table%' ORDER BY 1;
\c regression
Expand All @@ -231,11 +229,9 @@ DROP DIRECTORY TABLE dir_table4; -- fail
DROP DIRECTORY TABLE IF EXISTS dir_table5;
DROP DIRECTORY TABLE IF EXISTS dir_table5; -- skip

\dY
SELECT count(*) FROM pg_directory_table;
SELECT relname, relisshared, relpersistence, relkind FROM pg_class WHERE relname like '%dir_table%' ORDER BY 1;
\c dirtable_db
\dY
SELECT count(*) FROM pg_directory_table;
SELECT relname, relisshared, relpersistence, relkind FROM pg_class WHERE relname like '%dir_table%' ORDER BY 1;
\c regression
Expand Down
34 changes: 0 additions & 34 deletions src/test/regress/output/directory_table.source
Original file line number Diff line number Diff line change
Expand Up @@ -528,18 +528,6 @@ CREATE DIRECTORY TABLE IF NOT EXISTS dir_table2 TABLESPACE directory_tblspc;
NOTICE: relation "dir_table2" already exists, skipping
CREATE DIRECTORY TABLE dir_table5 TABLESPACE directory_tblspc;
CREATE DIRECTORY TABLE dir_table6 TABLESPACE pg_default;
\dY
List of relations
Schema | Name | Type | Owner
--------+------------+-----------------+---------
public | dir_table1 | directory table | gpadmin
public | dir_table2 | directory table | gpadmin
public | dir_table3 | directory table | gpadmin
public | dir_table4 | directory table | gpadmin
public | dir_table5 | directory table | gpadmin
public | dir_table6 | directory table | gpadmin
(6 rows)

SELECT count(*) FROM pg_directory_table;
count
-------
Expand Down Expand Up @@ -603,12 +591,6 @@ Indexes:
Distributed by: (relative_path)

\c dirtable_db
\dY
List of relations
Schema | Name | Type | Owner
--------+------+------+-------
(0 rows)

SELECT count(*) FROM pg_directory_table;
count
-------
Expand Down Expand Up @@ -643,16 +625,6 @@ ERROR: directory table "dir_table4" does not exist
DROP DIRECTORY TABLE IF EXISTS dir_table5;
DROP DIRECTORY TABLE IF EXISTS dir_table5; -- skip
NOTICE: directory table "dir_table5" does not exist, skipping
\dY
List of relations
Schema | Name | Type | Owner
--------+------------+-----------------+---------
public | dir_table1 | directory table | gpadmin
public | dir_table2 | directory table | gpadmin
public | dir_table3 | directory table | gpadmin
public | dir_table6 | directory table | gpadmin
(4 rows)

SELECT count(*) FROM pg_directory_table;
count
-------
Expand All @@ -673,12 +645,6 @@ SELECT relname, relisshared, relpersistence, relkind FROM pg_class WHERE relname
(8 rows)

\c dirtable_db
\dY
List of relations
Schema | Name | Type | Owner
--------+------+------+-------
(0 rows)

SELECT count(*) FROM pg_directory_table;
count
-------
Expand Down
34 changes: 0 additions & 34 deletions src/test/regress/output/directory_table_optimizer.source
Original file line number Diff line number Diff line change
Expand Up @@ -528,18 +528,6 @@ CREATE DIRECTORY TABLE IF NOT EXISTS dir_table2 TABLESPACE directory_tblspc;
NOTICE: relation "dir_table2" already exists, skipping
CREATE DIRECTORY TABLE dir_table5 TABLESPACE directory_tblspc;
CREATE DIRECTORY TABLE dir_table6 TABLESPACE pg_default;
\dY
List of relations
Schema | Name | Type | Owner
--------+------------+-----------------+---------
public | dir_table1 | directory table | gpadmin
public | dir_table2 | directory table | gpadmin
public | dir_table3 | directory table | gpadmin
public | dir_table4 | directory table | gpadmin
public | dir_table5 | directory table | gpadmin
public | dir_table6 | directory table | gpadmin
(6 rows)

SELECT count(*) FROM pg_directory_table;
count
-------
Expand Down Expand Up @@ -603,12 +591,6 @@ Indexes:
Distributed by: (relative_path)

\c dirtable_db
\dY
List of relations
Schema | Name | Type | Owner
--------+------+------+-------
(0 rows)

SELECT count(*) FROM pg_directory_table;
count
-------
Expand Down Expand Up @@ -643,16 +625,6 @@ ERROR: directory table "dir_table4" does not exist
DROP DIRECTORY TABLE IF EXISTS dir_table5;
DROP DIRECTORY TABLE IF EXISTS dir_table5; -- skip
NOTICE: directory table "dir_table5" does not exist, skipping
\dY
List of relations
Schema | Name | Type | Owner
--------+------------+-----------------+---------
public | dir_table1 | directory table | gpadmin
public | dir_table2 | directory table | gpadmin
public | dir_table3 | directory table | gpadmin
public | dir_table6 | directory table | gpadmin
(4 rows)

SELECT count(*) FROM pg_directory_table;
count
-------
Expand All @@ -673,12 +645,6 @@ SELECT relname, relisshared, relpersistence, relkind FROM pg_class WHERE relname
(8 rows)

\c dirtable_db
\dY
List of relations
Schema | Name | Type | Owner
--------+------+------+-------
(0 rows)

SELECT count(*) FROM pg_directory_table;
count
-------
Expand Down

0 comments on commit 6678582

Please sign in to comment.