-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
48c91b2
commit 7f68453
Showing
2 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,15 +204,22 @@ async def test_websockets_pipelined(static_proxy: NeonProxy): | |
|
||
@pytest.mark.asyncio | ||
async def test_websockets_tunneled(static_proxy: NeonProxy, port_distributor: PortDistributor): | ||
static_proxy.safe_psql("create user ws_auth with password 'ws' superuser") | ||
|
||
user = "ws_auth" | ||
password = "ws" | ||
|
||
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) | ||
ssl_context.load_verify_locations(str(static_proxy.test_output_dir / "proxy.crt")) | ||
|
||
# Launch a tunnel service so that we can speak the websockets protocol to | ||
# the proxy | ||
tunnel_port = port_distributor.get_port() | ||
tunnel_server = await websocket_tunnel.start_server( | ||
"127.0.0.1", | ||
tunnel_port, | ||
f"wss://ep-static-test.neon.localtest.me:{static_proxy.external_http_port}", | ||
"127.0.0.1", | ||
static_proxy.external_http_port, | ||
f"wss://{static_proxy.domain}:{static_proxy.external_http_port}/sql", | ||
ssl_context, | ||
) | ||
log.info(f"websockets tunnel listening for connections on port {tunnel_port}") | ||
|
||
|
@@ -229,7 +236,7 @@ async def run_tunnel(): | |
|
||
# Ok, the tunnel is now running. Check that we can connect to the proxy's | ||
# websocket interface, through the tunnel | ||
tunnel_connstring = f"postgres://proxy:[email protected]:{tunnel_port}/postgres" | ||
tunnel_connstring = f"postgres://{user}:{password}@127.0.0.1:{tunnel_port}/postgres" | ||
|
||
log.info(f"connecting to {tunnel_connstring}") | ||
conn = await asyncpg.connect(tunnel_connstring) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters