Skip to content

Commit 24c37ad

Browse files
Update for tests (#386)
* fix: TestTestgresCommon::test_dump does not use os_ops - os.path.isdir -> node_svc.os_ops.isdir - os.path.isfile -> node_svc.os_ops.isfile It fixes a work with a remote machine. * fix: TestTestgresCommon::test_dump_with_options does not use os_ops - os.path.isfile -> node_svc.os_ops.isfile It fixes a work with a remote machine. * test_node_app__make_empty_with_explicit_port is updated (+asserts) * test_node_app__make_empty_and_pgconf (+check status)
1 parent e742c9c commit 24c37ad

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/test_testgres_common.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,9 +1783,9 @@ def test_dump(self, node_svc: PostgresNodeService, dump_fmt: enums.DumpFormat):
17831783
with removing(node_svc.os_ops, node1.dump(format=dump_fmt)) as dump:
17841784
with __class__.helper__get_node(node_svc).init().start() as node3:
17851785
if dump_fmt == enums.DumpFormat.Directory:
1786-
assert (os.path.isdir(dump))
1786+
assert (node_svc.os_ops.isdir(dump))
17871787
else:
1788-
assert (os.path.isfile(dump))
1788+
assert (node_svc.os_ops.isfile(dump))
17891789
# restore dump
17901790
node3.restore(filename=dump)
17911791
res = node3.execute(query_select)
@@ -1801,7 +1801,7 @@ def test_dump_with_options(self, node_svc: PostgresNodeService):
18011801
# Test dump with --schema-only option
18021802
with removing(node_svc.os_ops, node1.dump(options=['--schema-only'])) as dump:
18031803
with __class__.helper__get_node(node_svc).init().start() as node2:
1804-
assert (os.path.isfile(dump))
1804+
assert (node_svc.os_ops.isfile(dump))
18051805
# restore schema-only dump
18061806
node2.restore(filename=dump)
18071807

@@ -2680,6 +2680,7 @@ def test_node_app__make_empty_with_explicit_port(self, node_svc: PostgresNodeSer
26802680
)
26812681

26822682
assert node_app.os_ops is node_svc.os_ops
2683+
assert node_app.port_manager is not None
26832684
assert node_app.port_manager is node_svc.port_manager
26842685
assert type(node_app.nodes_to_cleanup) is list
26852686
assert len(node_app.nodes_to_cleanup) == 0
@@ -2753,6 +2754,7 @@ def test_node_app__make_empty_with_explicit_port(self, node_svc: PostgresNodeSer
27532754
assert not node._should_free_port
27542755
break
27552756
finally:
2757+
assert node_app.port_manager is not None
27562758
while len(ports) > 0:
27572759
node_app.port_manager.release_port(ports.pop())
27582760

@@ -2809,6 +2811,8 @@ def test_node_app__make_empty_and_pgconf(self, node_svc: PostgresNodeService):
28092811

28102812
logging.info("Node is started ...")
28112813
node.slow_start()
2814+
2815+
assert node.status() == NodeStatus.Running
28122816
return
28132817

28142818
@staticmethod

0 commit comments

Comments
 (0)