Skip to content

Commit a5cfdb6

Browse files
author
vshepard
committed
Add bin_dir to make_simple
1 parent c0dca6b commit a5cfdb6

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

testgres/node.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,12 +1707,13 @@ def __init__(self, test_path=None, nodes_to_cleanup=None, os_ops=LocalOperations
17071707
def make_empty(
17081708
self,
17091709
base_dir=None,
1710-
port=None):
1710+
port=None,
1711+
bin_dir=None):
17111712
real_base_dir = os.path.join(self.test_path, base_dir)
17121713
self.os_ops.rmdirs(real_base_dir, ignore_errors=True)
17131714
self.os_ops.makedirs(real_base_dir)
17141715

1715-
node = PostgresNode(base_dir=real_base_dir, port=port)
1716+
node = PostgresNode(base_dir=real_base_dir, port=port, bin_dir=bin_dir)
17161717
node.should_rm_dirs = True
17171718
self.nodes_to_cleanup.append(node)
17181719

@@ -1726,10 +1727,11 @@ def make_simple(
17261727
ptrack_enable=False,
17271728
initdb_params=[],
17281729
pg_options={},
1729-
checksum=True):
1730+
checksum=True,
1731+
bin_dir=None):
17301732
if checksum and '--data-checksums' not in initdb_params:
17311733
initdb_params.append('--data-checksums')
1732-
node = self.make_empty(base_dir, port)
1734+
node = self.make_empty(base_dir, port, bin_dir=bin_dir)
17331735
node.init(
17341736
initdb_params=initdb_params, allow_streaming=set_replication)
17351737

tests/test_simple.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
BackupException, \
2424
QueryException, \
2525
TimeoutException, \
26-
TestgresException
26+
TestgresException, NodeApp
2727

2828
from testgres import \
2929
TestgresConfig, \
@@ -1044,6 +1044,23 @@ def test_the_same_port(self):
10441044
node2.port = node.port
10451045
node2.init().start()
10461046

1047+
def test_make_simple_with_bin_dir(self):
1048+
with get_new_node() as node:
1049+
node.init().start()
1050+
bin_dir = node.bin_dir
1051+
1052+
app = NodeApp()
1053+
correct_bin_dir = app.make_simple(base_dir=node.base_dir, bin_dir=bin_dir)
1054+
correct_bin_dir.slow_start()
1055+
correct_bin_dir.safe_psql("SELECT 1;")
1056+
1057+
try:
1058+
wrong_bin_dir = app.make_empty(base_dir=node.base_dir, bin_dir="wrong/path")
1059+
wrong_bin_dir.slow_start()
1060+
raise RuntimeError("Error was expected.") # We should not reach this
1061+
except FileNotFoundError:
1062+
pass # Expected error
1063+
10471064

10481065
if __name__ == '__main__':
10491066
if os.environ.get('ALT_CONFIG'):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy