- Notifications
You must be signed in to change notification settings - Fork35
Closed
Labels
Description
Alter execution of TestTestgresCommon::test_replication_slots one port is not released.
Not released port is allocated in NodeBackup::spawn_primary that is called in NodeBackup::spawn_replica:
Lines 187 to 192 in5f8f5dd
withclean_on_error(self.spawn_primary(name=name, | |
destroy=destroy))asnode: | |
# Assign it a master and a recovery file (private magic) | |
node._assign_master(self.original_node) | |
node._create_recovery_conf(username=self.username,slot=slot) |
NodeBackup::spawn_replica uses clean_on_error to destroy newly created node but clean_on_error does not call PostgresNode::free_port.
Lines 314 to 326 in5f8f5dd
@contextmanager | |
defclean_on_error(node): | |
""" | |
Context manager to wrap PostgresNode and such. | |
Calls cleanup() method when underlying code raises an exception. | |
""" | |
try: | |
yieldnode | |
exceptException: | |
# TODO: should we wrap this in try-block? | |
node.cleanup() | |
raise |
It seems to me, to fix this issue we can just call node.free_port method in clean_on_error immediatelly after node.cleanup.
Or we must to call node.free_port from node.cleanup.