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

Commit29a9efb

Browse files
committed
[PBCKP-325] refix test_issue_231
to make two backups in one second we have to fail them.Therefore we have to fetch backup_id from log in exception's message.Retry for 20 seconds to have a chance to start in one second.If we couldn't, lets skip the test.
1 parentbef73b8 commit29a9efb

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

‎tests/backup_test.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
importunittest
22
importos
3+
importre
34
fromtimeimportsleep,time
45
from .helpers.ptrack_helpersimportbase36enc,ProbackupTest,ProbackupException
56
importshutil
@@ -2780,18 +2781,33 @@ def test_issue_231(self):
27802781
"""
27812782
backup_dir=os.path.join(self.tmp_path,self.module_name,self.fname,'backup')
27822783
node=self.make_simple_node(
2783-
base_dir=os.path.join(self.module_name,self.fname,'node'),
2784-
set_replication=True,
2785-
initdb_params=['--data-checksums'])
2784+
base_dir=os.path.join(self.module_name,self.fname,'node'))
27862785

27872786
self.init_pb(backup_dir)
27882787
self.add_instance(backup_dir,'node',node)
2789-
node.slow_start()
27902788

27912789
datadir=os.path.join(node.data_dir,'123')
27922790

2793-
pb1=self.backup_node(backup_dir,'node',node,data_dir='{0}'.format(datadir))
2794-
pb2=self.backup_node(backup_dir,'node',node,options=['--stream'])
2791+
t0=time()
2792+
whileTrue:
2793+
withself.assertRaises(ProbackupException)asctx:
2794+
self.backup_node(backup_dir,'node',node)
2795+
pb1=re.search(r' backup ID: ([^\s,]+),',ctx.exception.message).groups()[0]
2796+
2797+
t=time()
2798+
ifint(pb1,36)==int(t)andt%1<0.5:
2799+
# ok, we have a chance to start next backup in same second
2800+
break
2801+
elift-t0>20:
2802+
# Oops, we are waiting for too long. Looks like this runner
2803+
# is too slow. Lets skip the test.
2804+
self.skipTest("runner is too slow")
2805+
# sleep to the second's end so backup will not sleep for a second.
2806+
sleep(1-t%1)
2807+
2808+
withself.assertRaises(ProbackupException)asctx:
2809+
self.backup_node(backup_dir,'node',node)
2810+
pb2=re.search(r' backup ID: ([^\s,]+),',ctx.exception.message).groups()[0]
27952811

27962812
self.assertNotEqual(pb1,pb2)
27972813

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp