Skip to content

Commit 3b3f628

Browse files
committed
fix tests
1 parent 27cf106 commit 3b3f628

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

testgres/testgres.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def init(self, allow_streaming=False, fsync=False, initdb_params=[]):
484484

485485
if allow_streaming:
486486
cur_ver = LooseVersion(get_pg_config()["VERSION_NUM"])
487-
min_ver = LooseVersion('9.6.0')
487+
min_ver = LooseVersion('9.6')
488488

489489
# select a proper wal_level for PostgreSQL
490490
wal_level = "hot_standby" if cur_ver < min_ver else "replica"
@@ -907,7 +907,7 @@ def catchup(self):
907907
master = self.master
908908

909909
cur_ver = LooseVersion(get_pg_config()["VERSION_NUM"])
910-
min_ver = LooseVersion('10.0')
910+
min_ver = LooseVersion('10')
911911

912912
if cur_ver >= min_ver:
913913
poll_lsn = "select pg_current_wal_lsn()::text"
@@ -1119,7 +1119,8 @@ def get_pg_config():
11191119

11201120
# Fetch version of PostgreSQL and save it as VERSION_NUM
11211121
version_parts = pg_config_data["VERSION"].split(" ")
1122-
pg_config_data["VERSION_NUM"] = version_parts[-1]
1122+
version, _, _ = version_parts[-1].partition('beta')
1123+
pg_config_data["VERSION_NUM"] = version
11231124

11241125
return pg_config_data
11251126

tests/test_simple.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
import logging.config
88
import subprocess
99

10-
from distutils.version import LooseVersion
11-
1210
from testgres import InitNodeException, \
1311
StartNodeException, ExecUtilException, \
14-
BackupException, QueryException
12+
BackupException, QueryException, CatchUpException
1513

1614
from testgres import get_new_node, get_pg_config
1715
from testgres import bound_ports
@@ -28,8 +26,6 @@ def test_double_init(self):
2826
node.init()
2927
except InitNodeException as e:
3028
got_exception = True
31-
except Exception as e:
32-
pass
3329

3430
self.assertTrue(got_exception)
3531

@@ -41,8 +37,6 @@ def test_uninitialized_start(self):
4137
node.start()
4238
except StartNodeException as e:
4339
got_exception = True
44-
except Exception as e:
45-
pass
4640

4741
self.assertTrue(got_exception)
4842

@@ -145,21 +139,17 @@ def test_control_data(self):
145139
node.get_control_data()
146140
except ExecUtilException as e:
147141
got_exception = True
148-
except Exception as e:
149-
pass
150142
self.assertTrue(got_exception)
151143

152144
got_exception = False
153145

154146
try:
155147
node.init()
156148
data = node.get_control_data()
157-
self.assertIsNotNode(data)
149+
self.assertIsNotNone(data)
158150
except ExecUtilException as e:
159151
print(e.message)
160152
got_exception = True
161-
except Exception as e:
162-
pass
163153
self.assertFalse(got_exception)
164154

165155
def test_backup_simple(self):
@@ -257,8 +247,8 @@ def test_incorrect_catchup(self):
257247
got_exception = False
258248
try:
259249
node.catchup()
260-
except Exception as e:
261-
pass
250+
except CatchUpException as e:
251+
got_exception = True
262252
self.assertTrue(got_exception)
263253

264254
def test_dump(self):

0 commit comments

Comments
 (0)