Skip to content

Commit 4ddf8a1

Browse files
committed
speedup test_archive_replica_not_null_offset
1 parent cfcba44 commit 4ddf8a1

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

tests/replica_test.py

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -841,44 +841,34 @@ def test_archive_replica_not_null_offset(self):
841841
self.backup_node(
842842
backup_dir, 'node', replica, replica.data_dir,
843843
options=[
844-
'--archive-timeout=30',
845-
'--log-level-console=LOG',
844+
'--archive-timeout=10',
846845
'--no-validate'],
847846
return_id=False)
848847

849-
try:
848+
with self.assertRaises(ProbackupException) as ctx:
850849
self.backup_node(
851850
backup_dir, 'node', replica, replica.data_dir,
852851
options=[
853-
'--archive-timeout=30',
852+
'--archive-timeout=10',
854853
'--log-level-console=LOG',
855854
'--no-validate'])
856-
# we should die here because exception is what we expect to happen
857-
self.assertEqual(
858-
1, 0,
859-
"Expecting Error because of archive timeout. "
860-
"\n Output: {0} \n CMD: {1}".format(
861-
repr(self.output), self.cmd))
862-
except ProbackupException as e:
863-
# vanilla -- 0/4000060
864-
# pgproee -- 0/4000078
865-
self.assertRegex(
866-
e.message,
867-
r'LOG: Looking for LSN (0/4000060|0/4000078|0/4000070) in segment: 000000010000000000000004',
868-
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
869-
repr(e.message), self.cmd))
870-
871-
self.assertRegex(
872-
e.message,
873-
r'INFO: Wait for LSN (0/4000060|0/4000078|0/4000070) in archived WAL segment',
874-
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
875-
repr(e.message), self.cmd))
876-
877-
self.assertIn(
878-
'ERROR: WAL segment 000000010000000000000004 could not be archived in 30 seconds',
879-
e.message,
880-
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
881-
repr(e.message), self.cmd))
855+
e = ctx.exception
856+
# vanilla -- 0/4000060
857+
# pgproee -- 0/4000078
858+
self.assertRegex(
859+
e.message,
860+
r'LOG: Looking for LSN (0/4000060|0/4000078|0/4000070) in segment: 000000010000000000000004',
861+
"\n CMD: {0}".format(self.cmd))
862+
863+
self.assertRegex(
864+
e.message,
865+
r'INFO: Wait for LSN (0/4000060|0/4000078|0/4000070) in archived WAL segment',
866+
"\n CMD: {0}".format(self.cmd))
867+
868+
self.assertRegex(
869+
e.message,
870+
r'ERROR: WAL segment 000000010000000000000004 could not be archived in \d+ seconds',
871+
"\n CMD: {0}".format(self.cmd))
882872

883873
# @unittest.skip("skip")
884874
def test_replica_toast(self):

0 commit comments

Comments
 (0)