Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf4686a4

Browse files
committed
improve test_backup_simple(), set max_attempts=0 in poll_query_until() by default
1 parentb9b1d01 commitf4686a4

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

‎testgres/testgres.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ def poll_query_until(self,
915915
dbname,
916916
query,
917917
username=None,
918-
max_attempts=60,
918+
max_attempts=0,
919919
sleep_time=1,
920920
expected=True,
921921
raise_programming_error=True,
@@ -1027,7 +1027,7 @@ def replicate(self, name, username=None,
10271027
backup=self.backup(username=username,xlog_method=xlog_method)
10281028
returnbackup.spawn_replica(name,use_logging=use_logging)
10291029

1030-
defcatchup(self):
1030+
defcatchup(self,username=None):
10311031
"""
10321032
Wait until async replica catches up with its master.
10331033
"""
@@ -1049,7 +1049,10 @@ def catchup(self):
10491049

10501050
try:
10511051
lsn=master.execute('postgres',poll_lsn)[0][0]
1052-
self.poll_query_until('postgres',wait_lsn.format(lsn))
1052+
self.poll_query_until(dbname='postgres',
1053+
username=username,
1054+
query=wait_lsn.format(lsn),
1055+
max_attempts=0)# infinite
10531056
exceptExceptionase:
10541057
raiseCatchUpException(_explain_exception(e))
10551058

‎tests/test_simple.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,18 @@ def test_control_data(self):
195195

196196
deftest_backup_simple(self):
197197
withget_new_node('master')asmaster:
198-
master.init(allow_streaming=True).start()
199198

199+
# enable streaming for backups
200+
master.init(allow_streaming=True)
201+
202+
# node must be running
203+
withself.assertRaises(BackupException):
204+
master.backup()
205+
206+
# it's time to start node
207+
master.start()
208+
209+
# fill node with some data
200210
master.psql('postgres',
201211
'create table test as select generate_series(1, 4) i')
202212

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp