Skip to content

Commit 1e8d912

Browse files
author
vshepard
committed
Fix failed test_ports_management
1 parent 43c91c0 commit 1e8d912

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

testgres/node.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@ def __init__(self, name=None, base_dir=None, port=None, conn_params: ConnectionP
152152
self.os_ops = testgres_config.os_ops
153153

154154
self.host = self.os_ops.host
155-
self.port = port or self.os_ops.port or reserve_port()
156-
157155
self.ssh_key = self.os_ops.ssh_key
158156

159157
# defaults for __exit__()
160158
self.cleanup_on_good_exit = testgres_config.node_cleanup_on_good_exit
161159
self.cleanup_on_bad_exit = testgres_config.node_cleanup_on_bad_exit
162160
self.shutdown_max_attempts = 3
163161

162+
self.port = port or self.os_ops.port or reserve_port()
163+
164164
# NOTE: for compatibility
165165
self.utils_log_name = self.utils_log_file
166166
self.pg_log_name = self.pg_log_file
@@ -810,6 +810,7 @@ def stop(self, params=None, wait=True):
810810

811811
self._maybe_stop_logger()
812812
self.is_started = False
813+
release_port(self.port)
813814
return self
814815

815816
def kill(self, someone=None):

tests/test_simple.py

+1
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ def test_make_simple_with_bin_dir(self):
10521052
correct_bin_dir = app.make_simple(base_dir=node.base_dir, bin_dir=bin_dir)
10531053
correct_bin_dir.slow_start()
10541054
correct_bin_dir.safe_psql("SELECT 1;")
1055+
correct_bin_dir.stop()
10551056

10561057
try:
10571058
wrong_bin_dir = app.make_empty(base_dir=node.base_dir, bin_dir="wrong/path")

0 commit comments

Comments
 (0)