Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
TestTestgresCommon.test_custom_init is added
  • Loading branch information
dmitry-lipetsk committed Apr 6, 2025
commit cd806178821edb817e0c9c87e2af8d7f42de09f9
21 changes: 21 additions & 0 deletions tests/test_testgres_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,27 @@ def test_node_repr(self, node_svc: PostgresNodeService):
pattern = r"PostgresNode\(name='.+', port=.+, base_dir='.+'\)"
assert re.match(pattern, str(node)) is not None

def test_custom_init(self, node_svc: PostgresNodeService):
assert isinstance(node_svc, PostgresNodeService)

with __class__.helper__get_node(node_svc) as node:
# enable page checksums
node.init(initdb_params=['-k']).start()

with __class__.helper__get_node(node_svc) as node:
node.init(
allow_streaming=True,
initdb_params=['--auth-local=reject', '--auth-host=reject'])

hba_file = os.path.join(node.data_dir, 'pg_hba.conf')
lines = node.os_ops.readlines(hba_file)

# check number of lines
assert (len(lines) >= 6)

# there should be no trust entries at all
assert not (any('trust' in s for s in lines))

def test_double_init(self, node_svc: PostgresNodeService):
assert isinstance(node_svc, PostgresNodeService)

Expand Down
20 changes: 0 additions & 20 deletions tests/test_testgres_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,6 @@ def rm_carriage_returns(out):


class TestTestgresLocal:
def test_custom_init(self):
with get_new_node() as node:
# enable page checksums
node.init(initdb_params=['-k']).start()

with get_new_node() as node:
node.init(
allow_streaming=True,
initdb_params=['--auth-local=reject', '--auth-host=reject'])

hba_file = os.path.join(node.data_dir, 'pg_hba.conf')
with open(hba_file, 'r') as conf:
lines = conf.readlines()

# check number of lines
assert (len(lines) >= 6)

# there should be no trust entries at all
assert not (any('trust' in s for s in lines))

def test_pg_config(self):
# check same instances
a = get_pg_config()
Expand Down
19 changes: 0 additions & 19 deletions tests/test_testgres_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,6 @@ def implicit_fixture(self):
testgres_config.set_os_ops(os_ops=prev_ops)
assert testgres_config.os_ops is prev_ops

def test_custom_init(self):
with __class__.helper__get_node() as node:
# enable page checksums
node.init(initdb_params=['-k']).start()

with __class__.helper__get_node() as node:
node.init(
allow_streaming=True,
initdb_params=['--auth-local=reject', '--auth-host=reject'])

hba_file = os.path.join(node.data_dir, 'pg_hba.conf')
lines = node.os_ops.readlines(hba_file)

# check number of lines
assert (len(lines) >= 6)

# there should be no trust entries at all
assert not (any('trust' in s for s in lines))

def test_init__LANG_С(self):
# PBCKP-1744
prev_LANG = os.environ.get("LANG")
Expand Down