Skip to content

Commit

Permalink
PG-1093 Add dedicated test cases for tde_heap and tde_heap_basic
Browse files Browse the repository at this point in the history
  • Loading branch information
artemgavrilov committed Oct 8, 2024
1 parent 622cc30 commit 5e8c728
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ update_compare_indexes_basic \
pg_tde_is_encrypted_basic \
test_issue_153_fix_basic \
multi_insert_basic \
subtransaction \
subtransaction_basic \
trigger_on_view_basic \
change_access_method_basic \
insert_update_delete_basic \
Expand Down
2 changes: 2 additions & 0 deletions expected/subtransaction.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
\set tde_am tde_heap
\i sql/subtransaction.inc
CREATE EXTENSION pg_tde;
SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per');
pg_tde_add_key_provider_file
Expand Down
32 changes: 32 additions & 0 deletions expected/subtransaction_basic.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
\set tde_am tde_heap_basic
\i sql/subtransaction.inc
CREATE EXTENSION pg_tde;
SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per');
pg_tde_add_key_provider_file
------------------------------
1
(1 row)

SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');
pg_tde_set_principal_key
--------------------------
t
(1 row)

BEGIN; -- Nesting level 1
SAVEPOINT sp;
CREATE TABLE foo(s TEXT); -- Nesting level 2
RELEASE SAVEPOINT sp;
SAVEPOINT sp;
CREATE TABLE bar(s TEXT); -- Nesting level 2
ROLLBACK TO sp; -- Rollback should not affect first subtransaction
COMMIT;
BEGIN; -- Nesting level 1
SAVEPOINT sp;
DROP TABLE foo; -- Nesting level 2
RELEASE SAVEPOINT sp;
SAVEPOINT sp;
CREATE TABLE bar(s TEXT); -- Nesting level 2
ROLLBACK TO sp; -- Rollback should not affect first subtransaction
COMMIT;
DROP EXTENSION pg_tde;
25 changes: 25 additions & 0 deletions sql/subtransaction.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CREATE EXTENSION pg_tde;

SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per');
SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');


BEGIN; -- Nesting level 1
SAVEPOINT sp;
CREATE TABLE foo(s TEXT); -- Nesting level 2
RELEASE SAVEPOINT sp;
SAVEPOINT sp;
CREATE TABLE bar(s TEXT); -- Nesting level 2
ROLLBACK TO sp; -- Rollback should not affect first subtransaction
COMMIT;

BEGIN; -- Nesting level 1
SAVEPOINT sp;
DROP TABLE foo; -- Nesting level 2
RELEASE SAVEPOINT sp;
SAVEPOINT sp;
CREATE TABLE bar(s TEXT); -- Nesting level 2
ROLLBACK TO sp; -- Rollback should not affect first subtransaction
COMMIT;

DROP EXTENSION pg_tde;
27 changes: 2 additions & 25 deletions sql/subtransaction.sql
Original file line number Diff line number Diff line change
@@ -1,25 +1,2 @@
CREATE EXTENSION pg_tde;

SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per');
SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');


BEGIN; -- Nesting level 1
SAVEPOINT sp;
CREATE TABLE foo(s TEXT); -- Nesting level 2
RELEASE SAVEPOINT sp;
SAVEPOINT sp;
CREATE TABLE bar(s TEXT); -- Nesting level 2
ROLLBACK TO sp; -- Rollback should not affect first subtransaction
COMMIT;

BEGIN; -- Nesting level 1
SAVEPOINT sp;
DROP TABLE foo; -- Nesting level 2
RELEASE SAVEPOINT sp;
SAVEPOINT sp;
CREATE TABLE bar(s TEXT); -- Nesting level 2
ROLLBACK TO sp; -- Rollback should not affect first subtransaction
COMMIT;

DROP EXTENSION pg_tde;
\set tde_am tde_heap
\i sql/subtransaction.inc
2 changes: 2 additions & 0 deletions sql/subtransaction_basic.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\set tde_am tde_heap_basic
\i sql/subtransaction.inc

0 comments on commit 5e8c728

Please sign in to comment.