Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RekGRpth committed Nov 16, 2023
1 parent 4b23556 commit 323c580
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/isolation2/expected/test_dropped.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
1: CREATE SCHEMA dropped_schema;
CREATE
1: SET search_path TO dropped_schema;
SET
1: SELECT diskquota.set_schema_quota('dropped_schema', '1 MB');
set_schema_quota
------------------

(1 row)
1: SELECT diskquota.wait_for_worker_new_epoch();
wait_for_worker_new_epoch
---------------------------
t
(1 row)
1: CREATE TABLE dropped_table(id int) DISTRIBUTED BY (id);
CREATE
1: INSERT INTO dropped_table SELECT generate_series(1, 100000);
INSERT 100000
1: SELECT diskquota.wait_for_worker_new_epoch();
wait_for_worker_new_epoch
---------------------------
t
(1 row)
1: DROP TABLE dropped_table;
DROP
1q: ... <quitting>

!\retcode gpstop -afr;
-- start_ignore
-- end_ignore
(exited with code 0)

1: SELECT pg_table_size('dropped_table'::regclass::oid) size;
ERROR: relation "dropped_table" does not exist
LINE 1: SELECT pg_table_size('dropped_table'::regclass::oid) size;
^
1: SELECT size FROM diskquota.table_size WHERE NOT EXISTS (SELECT 1 FROM pg_class WHERE tableid = oid) AND segid = -1;
size
------
(0 rows)
1: DROP SCHEMA dropped_schema CASCADE;
DROP
1q: ... <quitting>
41 changes: 41 additions & 0 deletions tests/isolation2/expected/test_temporary.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
1: CREATE SCHEMA temporary_schema;
CREATE
1: SET search_path TO temporary_schema;
SET
1: SELECT diskquota.set_schema_quota('temporary_schema', '1 MB');
set_schema_quota
------------------

(1 row)
1: SELECT diskquota.wait_for_worker_new_epoch();
wait_for_worker_new_epoch
---------------------------
t
(1 row)
1: CREATE TEMPORARY TABLE temporary_table(id int) DISTRIBUTED BY (id);
CREATE
1: INSERT INTO temporary_table SELECT generate_series(1, 100000);
INSERT 100000
1: SELECT diskquota.wait_for_worker_new_epoch();
wait_for_worker_new_epoch
---------------------------
t
(1 row)
1q: ... <quitting>

!\retcode gpstop -afr;
-- start_ignore
-- end_ignore
(exited with code 0)

1: SELECT pg_table_size('temporary_table'::regclass::oid) size;
ERROR: relation "temporary_table" does not exist
LINE 1: SELECT pg_table_size('temporary_table'::regclass::oid) size;
^
1: SELECT size FROM diskquota.table_size WHERE NOT EXISTS (SELECT 1 FROM pg_class WHERE tableid = oid) AND segid = -1;
size
------
(0 rows)
1: DROP SCHEMA temporary_schema CASCADE;
DROP
1q: ... <quitting>
2 changes: 2 additions & 0 deletions tests/isolation2/isolation2_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ test: test_relation_size
test: test_rejectmap
test: test_vacuum
test: test_truncate
test: test_temporary
test: test_dropped
test: test_postmaster_restart
test: test_worker_timeout
test: test_per_segment_config
Expand Down
16 changes: 16 additions & 0 deletions tests/isolation2/sql/test_dropped.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
1: CREATE SCHEMA dropped_schema;
1: SET search_path TO dropped_schema;
1: SELECT diskquota.set_schema_quota('dropped_schema', '1 MB');
1: SELECT diskquota.wait_for_worker_new_epoch();
1: CREATE TABLE dropped_table(id int) DISTRIBUTED BY (id);
1: INSERT INTO dropped_table SELECT generate_series(1, 100000);
1: SELECT diskquota.wait_for_worker_new_epoch();
1: DROP TABLE dropped_table;
1q:

!\retcode gpstop -afr;

1: SELECT pg_table_size('dropped_table'::regclass::oid) size;
1: SELECT size FROM diskquota.table_size WHERE NOT EXISTS (SELECT 1 FROM pg_class WHERE tableid = oid) AND segid = -1;
1: DROP SCHEMA dropped_schema CASCADE;
1q:
15 changes: 15 additions & 0 deletions tests/isolation2/sql/test_temporary.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1: CREATE SCHEMA temporary_schema;
1: SET search_path TO temporary_schema;
1: SELECT diskquota.set_schema_quota('temporary_schema', '1 MB');
1: SELECT diskquota.wait_for_worker_new_epoch();
1: CREATE TEMPORARY TABLE temporary_table(id int) DISTRIBUTED BY (id);
1: INSERT INTO temporary_table SELECT generate_series(1, 100000);
1: SELECT diskquota.wait_for_worker_new_epoch();
1q:

!\retcode gpstop -afr;

1: SELECT pg_table_size('temporary_table'::regclass::oid) size;
1: SELECT size FROM diskquota.table_size WHERE NOT EXISTS (SELECT 1 FROM pg_class WHERE tableid = oid) AND segid = -1;
1: DROP SCHEMA temporary_schema CASCADE;
1q:

0 comments on commit 323c580

Please sign in to comment.