Skip to content

Commit 5f8f5dd

Browse files
[test] TestTestgresLocal.test_upgrade_node is corrected (#246)
Let's "release" all our test nodes correctly.
1 parent 2f550d8 commit 5f8f5dd

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/test_testgres_local.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ def test_child_process_dies(self):
158158
def test_upgrade_node(self):
159159
old_bin_dir = os.path.dirname(get_bin_path("pg_config"))
160160
new_bin_dir = os.path.dirname(get_bin_path("pg_config"))
161-
node_old = get_new_node(prefix='node_old', bin_dir=old_bin_dir)
162-
node_old.init()
163-
node_old.start()
164-
node_old.stop()
165-
node_new = get_new_node(prefix='node_new', bin_dir=new_bin_dir)
166-
node_new.init(cached=False)
167-
res = node_new.upgrade_from(old_node=node_old)
168-
node_new.start()
169-
assert (b'Upgrade Complete' in res)
161+
with get_new_node(prefix='node_old', bin_dir=old_bin_dir) as node_old:
162+
node_old.init()
163+
node_old.start()
164+
node_old.stop()
165+
with get_new_node(prefix='node_new', bin_dir=new_bin_dir) as node_new:
166+
node_new.init(cached=False)
167+
res = node_new.upgrade_from(old_node=node_old)
168+
node_new.start()
169+
assert (b'Upgrade Complete' in res)
170170

171171
class tagPortManagerProxy:
172172
sm_prev_testgres_reserve_port = None

0 commit comments

Comments
 (0)