Make the tests produce more consistent outputs

pull/1661/head
Onder Kalaci 2017-09-22 20:20:10 +03:00
parent 4782f9f98a
commit 867224bdd7
3 changed files with 17 additions and 14 deletions

View File

@ -112,6 +112,9 @@ get_colocated_shard_array(PG_FUNCTION_ARGS)
Oid arrayTypeId = OIDOID; Oid arrayTypeId = OIDOID;
int colocatedShardIndex = 0; int colocatedShardIndex = 0;
/* sort to get consistent output */
colocatedShardList = SortList(colocatedShardList, CompareShardIntervalsById);
foreach(colocatedShardCell, colocatedShardList) foreach(colocatedShardCell, colocatedShardList)
{ {
ShardInterval *colocatedShardInterval = (ShardInterval *) lfirst( ShardInterval *colocatedShardInterval = (ShardInterval *) lfirst(

View File

@ -266,39 +266,39 @@ SELECT shards_colocated(1300000, 1300020);
(1 row) (1 row)
-- check co-located table list -- check co-located table list
SELECT UNNEST(get_colocated_table_array('table1_group1'))::regclass; SELECT UNNEST(get_colocated_table_array('table1_group1'))::regclass ORDER BY 1;
unnest unnest
--------------- ---------------
table2_group1
table1_group1 table1_group1
table2_group1
(2 rows) (2 rows)
SELECT UNNEST(get_colocated_table_array('table5_groupX'))::regclass; SELECT UNNEST(get_colocated_table_array('table5_groupX'))::regclass ORDER BY 1;
unnest unnest
--------------- ---------------
table5_groupx table5_groupx
(1 row) (1 row)
SELECT UNNEST(get_colocated_table_array('table6_append'))::regclass; SELECT UNNEST(get_colocated_table_array('table6_append'))::regclass ORDER BY 1;
unnest unnest
--------------- ---------------
table6_append table6_append
(1 row) (1 row)
-- check co-located shard list -- check co-located shard list
SELECT get_colocated_shard_array(1300000); SELECT get_colocated_shard_array(1300000) ORDER BY 1;
get_colocated_shard_array get_colocated_shard_array
--------------------------- ---------------------------
{1300004,1300000} {1300000,1300004}
(1 row) (1 row)
SELECT get_colocated_shard_array(1300016); SELECT get_colocated_shard_array(1300016) ORDER BY 1;
get_colocated_shard_array get_colocated_shard_array
--------------------------- ---------------------------
{1300016} {1300016}
(1 row) (1 row)
SELECT get_colocated_shard_array(1300020); SELECT get_colocated_shard_array(1300020) ORDER BY 1;
get_colocated_shard_array get_colocated_shard_array
--------------------------- ---------------------------
{1300020} {1300020}

View File

@ -134,14 +134,14 @@ SELECT shards_colocated(1300000, 1300016);
SELECT shards_colocated(1300000, 1300020); SELECT shards_colocated(1300000, 1300020);
-- check co-located table list -- check co-located table list
SELECT UNNEST(get_colocated_table_array('table1_group1'))::regclass; SELECT UNNEST(get_colocated_table_array('table1_group1'))::regclass ORDER BY 1;
SELECT UNNEST(get_colocated_table_array('table5_groupX'))::regclass; SELECT UNNEST(get_colocated_table_array('table5_groupX'))::regclass ORDER BY 1;
SELECT UNNEST(get_colocated_table_array('table6_append'))::regclass; SELECT UNNEST(get_colocated_table_array('table6_append'))::regclass ORDER BY 1;
-- check co-located shard list -- check co-located shard list
SELECT get_colocated_shard_array(1300000); SELECT get_colocated_shard_array(1300000) ORDER BY 1;
SELECT get_colocated_shard_array(1300016); SELECT get_colocated_shard_array(1300016) ORDER BY 1;
SELECT get_colocated_shard_array(1300020); SELECT get_colocated_shard_array(1300020) ORDER BY 1;
-- check FindShardIntervalIndex function -- check FindShardIntervalIndex function
SELECT find_shard_interval_index(1300000); SELECT find_shard_interval_index(1300000);