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

Commit035b639

Browse files
committed
validate fix
1 parent494b978 commit035b639

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

‎.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/tests/__pycache__/
3030
/tests/tmp_dirs/
3131
/tests/*pyc
32-
/helpers/*pyc
32+
/tests/helpers/*pyc
3333

3434
# Extra files
3535
/datapagemap.c

‎tests/validate_test.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_validate_wal_unreal_values(self):
7777
self.assertEqual(1,0,"Expecting Error because of validation to unreal time.\n Output: {0}\n CMD: {1}".format(
7878
repr(self.output),self.cmd))
7979
exceptProbackupException,e:
80-
self.assertTrue(re.match('WARNING: recovery can be done up to time [0-9-: ]+ and xid \d+\nERROR:not enough WAL records to time {0}\n\Z'.format(unreal_time_2),e.message),
80+
self.assertTrue('ERROR:not enough WAL records to time'ine.message,
8181
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message),self.cmd))
8282

8383
# Validate to real xid
@@ -98,7 +98,7 @@ def test_validate_wal_unreal_values(self):
9898
self.assertEqual(1,0,"Expecting Error because of validation to unreal xid.\n Output: {0}\n CMD: {1}".format(
9999
repr(self.output),self.cmd))
100100
exceptProbackupException,e:
101-
self.assertTrue(re.match('WARNING: recovery can be done up to time [0-9-: ]+ and xid \d+\nERROR:not enough WAL records to xid \d+\n\Z',e.message),
101+
self.assertTrue('ERROR:not enough WAL records to xid'ine.message,
102102
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message),self.cmd))
103103

104104
# Validate with backup ID
@@ -135,8 +135,8 @@ def test_validate_corrupt_wal_1(self):
135135
wals.sort()
136136
forwalinwals:
137137
f=open(os.path.join(wals_dir,wal),"rb+")
138-
f.seek(256)
139-
f.write(six.b("blablabla"))
138+
f.seek(42)
139+
f.write(six.b("blablablaadssaaaaaaaaaaaaaaa"))
140140
f.close
141141

142142
# Simple validate
@@ -145,9 +145,8 @@ def test_validate_corrupt_wal_1(self):
145145
self.assertEqual(1,0,"Expecting Error because of wal segments corruption.\n Output: {0}\n CMD: {1}".format(
146146
repr(self.output),self.cmd))
147147
exceptProbackupException,e:
148-
#TODO assert correct error message
149-
self.assertTrue(re.match('Possible WAL CORRUPTION\Z',e.message),
150-
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message),self.cmd))
148+
self.assertTrue('Possible WAL CORRUPTION'ine.message),
149+
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message),self.cmd)
151150

152151
self.assertEqual('CORRUPT',self.show_pb(node,id=backup_id)['status'],'Backup STATUS should be "CORRUPT"')
153152
node.stop()
@@ -188,7 +187,7 @@ def test_validate_corrupt_wal_2(self):
188187
wals.sort()
189188
forwalinwals:
190189
f=open(os.path.join(wals_dir,wal),"rb+")
191-
f.seek(256)
190+
f.seek(0)
192191
f.write(six.b("blablabla"))
193192
f.close
194193

@@ -198,9 +197,8 @@ def test_validate_corrupt_wal_2(self):
198197
self.assertEqual(1,0,"Expecting Error because of wal segments corruption.\n Output: {0}\n CMD: {1}".format(
199198
repr(self.output),self.cmd))
200199
exceptProbackupException,e:
201-
#TODO assert correct error message
202-
self.assertTrue(re.match('Possible WAL CORRUPTION\Z',e.message),
203-
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message),self.cmd))
200+
self.assertTrue('Possible WAL CORRUPTION'ine.message),
201+
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(repr(e.message),self.cmd)
204202

205203
self.assertEqual('CORRUPT',self.show_pb(node,id=backup_id)['status'],'Backup STATUS should be "CORRUPT"')
206204
node.stop()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp