diff options
author | Amit Kapila | 2022-08-03 10:01:17 +0000 |
---|---|---|
committer | Amit Kapila | 2022-08-03 10:01:17 +0000 |
commit | 0c20dd33db1607d6a85ffce24238c1e55e384b49 (patch) | |
tree | 282143a0cbf6c8d4d1d1c95dcc3c97c5f64d721c /src/test/subscription/t/014_binary.pl | |
parent | c67c2e2a29392b85ba7c728d3ceed986808eeec3 (diff) |
Add wait_for_subscription_sync for TAP tests.
The TAP tests for logical replication in src/test/subscription are using
the following code in many places to make sure that the subscription is
synchronized with the publisher:
$node_publisher->wait_for_catchup('tap_sub');
$node_subscriber->poll_query_until('postgres',
qq[SELECT count(1) = 0
FROM pg_subscription_rel
WHERE srsubstate NOT IN ('r', 's')]);
The new function wait_for_subscription_sync() can be used to replace the
above code. This eliminates duplicated code and makes it easier to write
future tests.
Author: Masahiko Sawada
Reviewed by: Amit Kapila, Shi yu
Discussion: https://postgr.es/m/CAD21AoC-fvAkaKHa4t1urupwL8xbAcWRePeETvshvy80f6WV1A@mail.gmail.com
Diffstat (limited to 'src/test/subscription/t/014_binary.pl')
-rw-r--r-- | src/test/subscription/t/014_binary.pl | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/test/subscription/t/014_binary.pl b/src/test/subscription/t/014_binary.pl index a1f03e7adc2..8d8b35721fc 100644 --- a/src/test/subscription/t/014_binary.pl +++ b/src/test/subscription/t/014_binary.pl @@ -46,10 +46,7 @@ $node_subscriber->safe_psql('postgres', . "PUBLICATION tpub WITH (slot_name = tpub_slot, binary = true)"); # Ensure nodes are in sync with each other -$node_publisher->wait_for_catchup('tsub'); -$node_subscriber->poll_query_until('postgres', - "SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('s', 'r');" -) or die "Timed out while waiting for subscriber to synchronize data"; +$node_subscriber->wait_for_subscription_sync($node_publisher, 'tsub'); # Insert some content and make sure it's replicated across $node_publisher->safe_psql( |