Skip to content

Commit 512a3a1

Browse files
committed
PG-1870 Enable table encryption by default in TAP
This enables table encryption by default in TAP tests when TDE_MODE=1. Use TDE_MODE_SMGR=0 to turn off table encryption when running with pg_tde loaded. The setup for running regress with tde turned on has been slightly modified to match what is done for TAP tests to let tests that run the regress suite under TAP work.
1 parent fdb5223 commit 512a3a1

21 files changed

+143
-40
lines changed

ci_scripts/tde_setup.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CREATE SCHEMA IF NOT EXISTS tde;
2-
CREATE EXTENSION IF NOT EXISTS pg_tde SCHEMA tde;
1+
CREATE SCHEMA IF NOT EXISTS _pg_tde;
2+
CREATE EXTENSION IF NOT EXISTS pg_tde SCHEMA _pg_tde;
33
\! rm -f '/tmp/pg_tde_test_keyring.per'
4-
SELECT tde.pg_tde_add_database_key_provider_file('reg_file-vault', '/tmp/pg_tde_test_keyring.per');
5-
SELECT tde.pg_tde_create_key_using_database_key_provider('test-db-key', 'reg_file-vault');
6-
SELECT tde.pg_tde_set_key_using_database_key_provider('test-db-key', 'reg_file-vault');
4+
SELECT _pg_tde.pg_tde_add_database_key_provider_file('reg_file-vault', '/tmp/pg_tde_test_keyring.per');
5+
SELECT _pg_tde.pg_tde_create_key_using_database_key_provider('test-db-key', 'reg_file-vault');
6+
SELECT _pg_tde.pg_tde_set_key_using_database_key_provider('test-db-key', 'reg_file-vault');

ci_scripts/tde_setup_global.sql

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
CREATE SCHEMA tde;
2-
CREATE EXTENSION IF NOT EXISTS pg_tde SCHEMA tde;
1+
CREATE SCHEMA IF NOT EXISTS _pg_tde;
2+
CREATE EXTENSION IF NOT EXISTS pg_tde SCHEMA _pg_tde;
33

44
\! rm -f '/tmp/pg_tde_test_keyring.per'
5-
SELECT tde.pg_tde_add_global_key_provider_file('reg_file-global', '/tmp/pg_tde_test_keyring.per');
6-
SELECT tde.pg_tde_create_key_using_global_key_provider('server-key', 'reg_file-global');
7-
SELECT tde.pg_tde_set_server_key_using_global_key_provider('server-key', 'reg_file-global');
5+
SELECT _pg_tde.pg_tde_add_global_key_provider_file('reg_file-global', '/tmp/pg_tde_test_keyring.per');
6+
SELECT _pg_tde.pg_tde_create_key_using_global_key_provider('server-key', 'reg_file-global');
7+
SELECT _pg_tde.pg_tde_set_server_key_using_global_key_provider('server-key', 'reg_file-global');
88
ALTER SYSTEM SET pg_tde.wal_encrypt = on;
99
ALTER SYSTEM SET default_table_access_method = 'tde_heap';
10-
ALTER SYSTEM SET search_path = "$user",public,tde;
1110
-- restart required

contrib/amcheck/t/001_verify_heapam.pl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
use Test::More;
1111

12+
if ($ENV{TDE_MODE_SMGR} and not $ENV{TDE_MODE_NOSKIP})
13+
{
14+
plan skip_all => "hacks relation files directly for scaffolding";
15+
}
16+
1217
my ($node, $result);
1318

1419
#

src/bin/pg_amcheck/t/003_check.pl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
use Test::More;
1111

12+
if ($ENV{TDE_MODE_SMGR} and not $ENV{TDE_MODE_NOSKIP})
13+
{
14+
plan skip_all => "hacks relation files directly for scaffolding";
15+
}
16+
1217
my ($node, $port, %corrupt_page, %remove_relation);
1318

1419
# Returns the filesystem path for the named relation.

src/bin/pg_amcheck/t/005_opclass_damage.pl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
use PostgreSQL::Test::Utils;
1111
use Test::More;
1212

13+
if ($ENV{TDE_MODE_SMGR} and not $ENV{TDE_MODE_NOSKIP})
14+
{
15+
plan skip_all => 'investigate why this fails';
16+
}
17+
1318
my $node = PostgreSQL::Test::Cluster->new('test');
1419
$node->init;
1520
$node->start;

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"pg_basebackup without -E from server with encrypted WAL produces broken backups";
1717
}
1818

19+
if ($ENV{TDE_MODE_SMGR} and not $ENV{TDE_MODE_NOSKIP})
20+
{
21+
plan skip_all =>
22+
'uses corrupt_page_checksum to directly hack relation files';
23+
}
24+
1925
program_help_ok('pg_basebackup');
2026
program_version_ok('pg_basebackup');
2127
program_options_handling_ok('pg_basebackup');

src/bin/pg_checksums/t/002_actions.pl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
use Test::More;
1414

15+
if ($ENV{TDE_MODE_SMGR} and not $ENV{TDE_MODE_NOSKIP})
16+
{
17+
plan skip_all =>
18+
'uses corrupt_page_checksum to directly hack relation files';
19+
}
1520

1621
# Utility routine to create and check a table with corrupted checksums
1722
# on a wanted tablespace. Note that this stops and starts the node

src/bin/pg_dump/t/004_pg_dump_parallel.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
use PostgreSQL::Test::Utils;
99
use Test::More;
1010

11+
if ($ENV{TDE_MODE_SMGR} and not $ENV{TDE_MODE_NOSKIP})
12+
{
13+
plan skip_all =>
14+
'pg_restore fail to restore _pg_tde schema on cluster which already has it';
15+
}
16+
1117
my $dbname1 = 'regression_src';
1218
my $dbname2 = 'regression_dest1';
1319
my $dbname3 = 'regression_dest2';

src/bin/pg_dump/t/010_dump_connstr.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
use PostgreSQL::Test::Utils;
99
use Test::More;
1010

11+
if ($ENV{TDE_MODE_SMGR} and not $ENV{TDE_MODE_NOSKIP})
12+
{
13+
plan skip_all =>
14+
'pg_restore fail to restore _pg_tde schema on cluster which already has it';
15+
}
16+
1117
if ($PostgreSQL::Test::Utils::is_msys2)
1218
{
1319
plan skip_all => 'High bit name tests fail on Msys2';

src/bin/pg_upgrade/t/002_pg_upgrade.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
use PostgreSQL::Test::AdjustUpgrade;
1616
use Test::More;
1717

18+
if ($ENV{TDE_MODE_SMGR} and not $ENV{TDE_MODE_NOSKIP})
19+
{
20+
plan skip_all =>
21+
'pg_restore fail to restore _pg_tde schema on cluster which already has it';
22+
}
23+
1824
# Can be changed to test the other modes.
1925
my $mode = $ENV{PG_TEST_PG_UPGRADE_MODE} || '--copy';
2026

0 commit comments

Comments
 (0)