Make single_node_truncate.sql re-runnable

First of all, this commit sets next_shard_id for
single_node_truncate.sql because shard ids in the test output were
changing whenever we modify a prior test file.

Then the flaky test detector started complaining about
single_node_truncate.sql. We fix that by specifying the correct
test dependency for it in run_test.py.
pull/6741/head
Onur Tirtir 2023-03-02 12:42:40 +03:00
parent 40105bf1fc
commit a9820e96a3
3 changed files with 38 additions and 35 deletions

View File

@ -85,6 +85,7 @@ if __name__ == "__main__":
"create_role_propagation": TestDeps(None, ["multi_cluster_management"]),
"single_node_enterprise": TestDeps(None),
"single_node": TestDeps(None),
"single_node_truncate": TestDeps(None),
"multi_extension": TestDeps(None, repeatable=False),
"multi_test_helpers": TestDeps(None),
"multi_insert_select": TestDeps("base_schedule"),

View File

@ -1,6 +1,7 @@
CREATE SCHEMA single_node_truncate;
SET search_path TO single_node_truncate;
SET citus.shard_replication_factor TO 1;
SET citus.next_shard_id TO 91630500;
-- helper view that prints out local table names and sizes in the schema
CREATE VIEW table_sizes AS
SELECT
@ -28,12 +29,12 @@ CREATE TABLE citus_local(id int, ref_id int REFERENCES ref(id));
INSERT INTO citus_local SELECT x,x FROM generate_series(1,10000) x;
-- verify that shell tables for citus local tables are empty
SELECT * FROM table_sizes;
name | has_data
name | has_data
---------------------------------------------------------------------
citus_local | f
citus_local_102049 | t
ref | t
ref_102048 | t
citus_local | f
citus_local_91630501 | t
ref | t
ref_91630500 | t
(4 rows)
-- verify that this UDF is noop on Citus local tables
@ -44,12 +45,12 @@ SELECT truncate_local_data_after_distributing_table('citus_local');
(1 row)
SELECT * FROM table_sizes;
name | has_data
name | has_data
---------------------------------------------------------------------
citus_local | f
citus_local_102049 | t
ref | t
ref_102048 | t
citus_local | f
citus_local_91630501 | t
ref | t
ref_91630500 | t
(4 rows)
-- test that we allow cascading truncates to citus local tables
@ -62,12 +63,12 @@ NOTICE: truncate cascades to table "citus_local"
(1 row)
SELECT * FROM table_sizes;
name | has_data
name | has_data
---------------------------------------------------------------------
citus_local | f
citus_local_102049 | t
ref | f
ref_102048 | t
citus_local | f
citus_local_91630501 | t
ref | f
ref_91630500 | t
(4 rows)
ROLLBACK;
@ -95,17 +96,17 @@ NOTICE: truncate cascades to table "dist"
(1 row)
SELECT * FROM table_sizes;
name | has_data
name | has_data
---------------------------------------------------------------------
citus_local | f
citus_local_102049 | t
dist | f
dist_102051 | t
dist_102052 | t
dist_102053 | t
dist_102054 | t
ref | f
ref_102048 | t
citus_local | f
citus_local_91630501 | t
dist | f
dist_91630503 | t
dist_91630504 | t
dist_91630505 | t
dist_91630506 | t
ref | f
ref_91630500 | t
(9 rows)
ROLLBACK;
@ -118,17 +119,17 @@ SELECT truncate_local_data_after_distributing_table('dist');
(1 row)
SELECT * FROM table_sizes;
name | has_data
name | has_data
---------------------------------------------------------------------
citus_local | f
citus_local_102049 | t
dist | f
dist_102051 | t
dist_102052 | t
dist_102053 | t
dist_102054 | t
ref | t
ref_102048 | t
citus_local | f
citus_local_91630501 | t
dist | f
dist_91630503 | t
dist_91630504 | t
dist_91630505 | t
dist_91630506 | t
ref | t
ref_91630500 | t
(9 rows)
ROLLBACK;

View File

@ -1,6 +1,7 @@
CREATE SCHEMA single_node_truncate;
SET search_path TO single_node_truncate;
SET citus.shard_replication_factor TO 1;
SET citus.next_shard_id TO 91630500;
-- helper view that prints out local table names and sizes in the schema
CREATE VIEW table_sizes AS