Content-Length: 2395 | pFad | http://github.com/postgrespro/testgres/pull/132.patch
thub.com
From ce33dae0571968a15ce6aa931215ce1751e7fd9a Mon Sep 17 00:00:00 2001
From: asavchkov
Date: Fri, 21 Jun 2024 23:07:14 +0700
Subject: [PATCH] Pass DB port to NodeApp
---
testgres/node.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/testgres/node.py b/testgres/node.py
index e5e8fd5f..f7109b0c 100644
--- a/testgres/node.py
+++ b/testgres/node.py
@@ -127,7 +127,7 @@ def __repr__(self):
class PostgresNode(object):
- def __init__(self, name=None, port=None, base_dir=None, conn_params: ConnectionParams = ConnectionParams(), bin_dir=None, prefix=None):
+ def __init__(self, name=None, base_dir=None, port=None, conn_params: ConnectionParams = ConnectionParams(), bin_dir=None, prefix=None):
"""
PostgresNode constructor.
@@ -156,9 +156,9 @@ def __init__(self, name=None, port=None, base_dir=None, conn_params: ConnectionP
else:
self.os_ops = LocalOperations(conn_params)
+ self.host = self.os_ops.host
self.port = port or reserve_port()
- self.host = self.os_ops.host
self.ssh_key = self.os_ops.ssh_key
# defaults for __exit__()
@@ -1690,12 +1690,13 @@ def __init__(self, test_path, nodes_to_cleanup, os_ops=LocalOperations()):
def make_empty(
self,
- base_dir=None):
+ base_dir=None,
+ port=None):
real_base_dir = os.path.join(self.test_path, base_dir)
self.os_ops.rmdirs(real_base_dir, ignore_errors=True)
self.os_ops.makedirs(real_base_dir)
- node = PostgresNode(base_dir=real_base_dir)
+ node = PostgresNode(base_dir=real_base_dir, port=port)
node.should_rm_dirs = True
self.nodes_to_cleanup.append(node)
@@ -1704,6 +1705,7 @@ def make_empty(
def make_simple(
self,
base_dir=None,
+ port=None,
set_replication=False,
ptrack_enable=False,
initdb_params=[],
@@ -1711,7 +1713,7 @@ def make_simple(
checksum=True):
if checksum and '--data-checksums' not in initdb_params:
initdb_params.append('--data-checksums')
- node = self.make_empty(base_dir)
+ node = self.make_empty(base_dir, port)
node.init(
initdb_params=initdb_params, allow_streaming=set_replication)
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/postgrespro/testgres/pull/132.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy