Skip to content

Commit c2d779a

Browse files
committed
Make PG checkpoint test less flaky
Only run checkpoint and check metrics on the primary. This will remove the possible uncertainty of having the Checkpoint record being correctly propagated to the standby before standby's checkpoint is triggered.
1 parent 1ece735 commit c2d779a

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

postgres/tests/test_pg_replication.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,18 @@ def test_conflicts_bufferpin(aggregator, integration_check, pg_instance, pg_repl
221221

222222

223223
@requires_over_10
224-
def test_pg_control_replication(aggregator, integration_check, pg_instance, pg_replica_instance):
225-
check = integration_check(pg_replica_instance)
224+
def test_pg_control_replication(aggregator, integration_check, pg_instance):
225+
check = integration_check(pg_instance)
226226
check.run()
227227

228-
dd_agent_tags = _get_expected_tags(check, pg_replica_instance, role='standby')
228+
dd_agent_tags = _get_expected_tags(check, pg_instance, role='master')
229229
aggregator.assert_metric('postgresql.control.timeline_id', count=1, value=1, tags=dd_agent_tags)
230230

231231
# Also checkpoint on primary to generate changes
232232
master_conn = _get_superconn(pg_instance)
233233
with master_conn.cursor() as cur:
234234
cur.execute("CHECKPOINT;")
235235

236-
postgres_conn = _get_superconn(pg_replica_instance)
237-
with postgres_conn.cursor() as cur:
238-
cur.execute("CHECKPOINT;")
239-
240236
aggregator.reset()
241237
check.run()
242238
# checkpoint should be less than 2s old

0 commit comments

Comments
 (0)