Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita5cfdb6

Browse files
author
vshepard
committed
Add bin_dir to make_simple
1 parentc0dca6b commita5cfdb6

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
defmake_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
ifchecksumand'--data-checksums'notininitdb_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
fromtestgresimport \
2929
TestgresConfig, \
@@ -1044,6 +1044,23 @@ def test_the_same_port(self):
10441044
node2.port=node.port
10451045
node2.init().start()
10461046

1047+
deftest_make_simple_with_bin_dir(self):
1048+
withget_new_node()asnode:
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+
raiseRuntimeError("Error was expected.")# We should not reach this
1061+
exceptFileNotFoundError:
1062+
pass# Expected error
1063+
10471064

10481065
if__name__=='__main__':
10491066
ifos.environ.get('ALT_CONFIG'):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp