Skip to content

Releasing of reserved port in tests #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions tests/test_testgres_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,20 @@ def test_backup_wrong_xlog_method(self, node_svc: PostgresNodeService):

def test_pg_ctl_wait_option(self, node_svc: PostgresNodeService):
assert isinstance(node_svc, PostgresNodeService)
C_MAX_ATTEMPTS = 50
with __class__.helper__get_node(node_svc) as node:
self.impl__test_pg_ctl_wait_option(node_svc, node)

node = __class__.helper__get_node(node_svc)
def impl__test_pg_ctl_wait_option(
self,
node_svc: PostgresNodeService,
node: PostgresNode
) -> None:
assert isinstance(node_svc, PostgresNodeService)
assert isinstance(node, PostgresNode)
assert node.status() == NodeStatus.Uninitialized

C_MAX_ATTEMPTS = 50

node.init()
assert node.status() == NodeStatus.Stopped
node.start(wait=False)
Expand Down Expand Up @@ -950,7 +960,6 @@ def test_pg_ctl_wait_option(self, node_svc: PostgresNodeService):
raise Exception("Unexpected node status: {0}.".format(s1))

logging.info("OK. Node is stopped.")
node.cleanup()

def test_replicate(self, node_svc: PostgresNodeService):
assert isinstance(node_svc, PostgresNodeService)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_testgres_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ def test_simple_with_bin_dir(self):
bin_dir = node.bin_dir

app = NodeApp()
correct_bin_dir = app.make_simple(base_dir=node.base_dir, bin_dir=bin_dir)
correct_bin_dir.slow_start()
correct_bin_dir.safe_psql("SELECT 1;")
correct_bin_dir.stop()
with app.make_simple(base_dir=node.base_dir, bin_dir=bin_dir) as correct_bin_dir:
correct_bin_dir.slow_start()
correct_bin_dir.safe_psql("SELECT 1;")
correct_bin_dir.stop()

while True:
try:
Expand Down