Skip to content

Commit

Permalink
Add tunnel_port to remote_ops.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vshepard committed Jun 6, 2024
1 parent 48594f6 commit fffb23c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions testgres/operations/remote_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, conn_params: ConnectionParams):
self.remote = True
self.username = conn_params.username or self.get_user()
self.tunnel_process = None
self.tunnel_port = None

def __enter__(self):
return self
Expand Down Expand Up @@ -410,6 +411,7 @@ def db_connect(self, dbname, user, password=None, host="localhost", port=5432):
Establish SSH tunnel and connect to a PostgreSQL database.
"""
local_port = reserve_port()
self.tunnel_port = local_port
self.establish_ssh_tunnel(local_port=local_port, remote_port=port)
try:
conn = pglib.connect(
Expand Down

0 comments on commit fffb23c

Please sign in to comment.