Improve tests

pull/1403/head
Onder Kalaci 2017-05-10 12:09:12 +03:00
parent c9df9f37d6
commit 0884783de1
2 changed files with 41 additions and 30 deletions

View File

@ -8,11 +8,11 @@ step s1-begin:
BEGIN;
step s1-add-second-worker:
SELECT master_add_node('localhost', 57638);
SELECT nodename, nodeport, isactive FROM master_add_node('localhost', 57638);
master_add_node
nodename nodeport isactive
(4,4,localhost,57638,default,f,t)
localhost 57638 t
step s2-begin:
BEGIN;
@ -27,12 +27,17 @@ step s2-commit:
COMMIT;
step s2-print-content:
SELECT run_command_on_placements('test_reference_table', 'select count(*) from %s');
SELECT
nodeport, success, result
FROM
run_command_on_placements('test_reference_table', 'select count(*) from %s')
ORDER BY
nodeport;
run_command_on_placements
nodeport success result
(localhost,57637,102197,t,5)
(localhost,57638,102197,t,5)
57637 t 5
57638 t 5
step s1-remove-second-worker:
SELECT master_remove_node('localhost', 57638);
@ -43,11 +48,11 @@ step s1-begin:
BEGIN;
step s1-add-second-worker:
SELECT master_add_node('localhost', 57638);
SELECT nodename, nodeport, isactive FROM master_add_node('localhost', 57638);
master_add_node
nodename nodeport isactive
(5,5,localhost,57638,default,f,t)
localhost 57638 t
step s2-begin:
BEGIN;
@ -62,12 +67,17 @@ step s2-commit:
COMMIT;
step s2-print-content:
SELECT run_command_on_placements('test_reference_table', 'select count(*) from %s');
SELECT
nodeport, success, result
FROM
run_command_on_placements('test_reference_table', 'select count(*) from %s')
ORDER BY
nodeport;
run_command_on_placements
nodeport success result
(localhost,57637,102197,t,10)
(localhost,57638,102197,t,10)
master_add_node
57637 t 10
57638 t 10
nodename nodeport isactive
(5,5,localhost,57638,default,f,t)
localhost 57638 t

View File

@ -1,23 +1,18 @@
# remove one of the nodes for the purpose of the test
setup
{
truncate pg_dist_shard_placement;
truncate pg_dist_shard;
truncate pg_dist_partition;
truncate pg_dist_colocation;
truncate pg_dist_node;
SELECT master_add_node('localhost', 57637);
SELECT master_remove_node('localhost', 57638);
CREATE TABLE test_reference_table (test_id integer);
SELECT create_reference_table('test_reference_table');
}
# ensure that both nodes exists for the remaining of the isolation tests
teardown
{
DROP TABLE IF EXISTS test_reference_table CASCADE;
SELECT master_add_node('localhost', 57637);
SELECT master_add_node('localhost', 57638);
DROP TABLE test_reference_table;
SELECT nodename, nodeport, isactive FROM master_add_node('localhost', 57637);
SELECT nodename, nodeport, isactive FROM master_add_node('localhost', 57638);
}
session "s1"
@ -29,7 +24,7 @@ step "s1-begin"
step "s1-add-second-worker"
{
SELECT master_add_node('localhost', 57638);
SELECT nodename, nodeport, isactive FROM master_add_node('localhost', 57638);
}
step "s1-remove-second-worker"
@ -61,9 +56,15 @@ step "s2-commit"
step "s2-print-content"
{
SELECT run_command_on_placements('test_reference_table', 'select count(*) from %s');
SELECT
nodeport, success, result
FROM
run_command_on_placements('test_reference_table', 'select count(*) from %s')
ORDER BY
nodeport;
}
# verify that copy gets the invalidation and re-builts its metadata cache
# note that we need to run the same test twice to ensure that metadata is cached
# otherwise the test would be useless since the cache would be empty and the