Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a websockets tunnel and a test for the proxy's websockets support. #3823

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hlinnaka
Copy link
Contributor

@hlinnaka hlinnaka commented Mar 15, 2023

For testing the proxy's websockets support.

I wrote this to test #3822. Unfortunately, that bug can not be reproduced with this tunnel. The bug only appears when the client pipelines the first query with the authentication messages. The tunnel doesn't do that.


Update (@conradludgate 2025-01-10):

We have since added some websocket tests, but they manually implemented a very simplistic setup of the postgres protocol. Introducing the tunnel would make more complex testing simpler in the future.

@hlinnaka hlinnaka requested review from kelvich and arssher March 15, 2023 08:27
@hlinnaka
Copy link
Contributor Author

So, this doesn't actually reproduce the bug I wanted to test with this, so this isn't as useful as I thought. But since I wrote it, here's a PR.

Should we commit this anyway, or find some other testing strategy?

@hlinnaka hlinnaka force-pushed the add-websockets-tunnel-and-test branch from e58b64a to ee74198 Compare March 15, 2023 08:29
@arssher
Copy link
Contributor

arssher commented Mar 15, 2023

Nice! But as you said, it is more useful to test real js client, so let's add something similar to what Stas did at sk/proxy-wss-test-wip branch to pg_clients suite. Arthur created issue for that:
#3819
@petuhovskiy would you pick it up?

@petuhovskiy
Copy link
Member

This test looks like a nice way to test basic websocket proxy logic without a dependency on Docker/NodeJS/console. Even if it doesn't reproduce a bug that we have, I think it still will be useful to have such a test.

Also, wanted to look at the logs, but it seems that currently test doesn't work in CI:

 /github/home/.cache/pypoetry/virtualenvs/neon-_pxWMzVK-py3.9/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
    exec(co, module.__dict__)
test_runner/regress/test_proxy.py:6: in <module>
    import websocket_tunnel
E     File "/__w/neon/neon/test_runner/websocket_tunnel.py", line 101
E       except* Exception as ex:
E             ^
E   SyntaxError: invalid syntax

@kelvich
Copy link
Contributor

kelvich commented Mar 15, 2023

+1 good to have it in the CI.

I was thinking about a similar setup with python test calling docker run with js app inside and check output.

@hlinnaka
Copy link
Contributor Author

@conradludgate I just remembered this PR. I don't know what we should do with it, and I don't plan to work on it anymore. But maybe you find it useful? If not, feel free to close it.

@conradludgate
Copy link
Contributor

Thanks, I'll take a look

@conradludgate
Copy link
Contributor

Ah yes this will be very useful. I was looking to add some websocket tests last week, glad I checked my notifications again. I'll sort out this PR and merge it in. Thanks!

@conradludgate conradludgate force-pushed the add-websockets-tunnel-and-test branch from ee74198 to 9594763 Compare October 17, 2023 17:44
@github-actions
Copy link

github-actions bot commented Oct 17, 2023

7293 tests run: 6929 passed, 0 failed, 364 skipped (full report)


Code coverage* (full report)

  • functions: 32.7% (8043 of 24618 functions)
  • lines: 47.8% (66823 of 139908 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
6fc1a82 at 2025-01-10T17:51:08.619Z :recycle:

@ololobus ololobus marked this pull request as draft January 10, 2025 13:11
@ololobus
Copy link
Member

This PR has been automatically marked as Draft because it was last updated 450 days ago. Please, consider closing it if it's not needed anymore.

For testing the proxy's websockets support.

I wrote this to test #3822.
Unfortunately, that bug can *not* be reproduced with this tunnel. The
bug only appears when the client pipelines the first query with the
authentication messages. The tunnel doesn't do that.
@conradludgate conradludgate force-pushed the add-websockets-tunnel-and-test branch from 9594763 to cb32117 Compare January 10, 2025 13:34
@conradludgate conradludgate marked this pull request as ready for review January 10, 2025 16:52
@conradludgate conradludgate requested review from a team and awarus and removed request for a team January 10, 2025 16:52
from fixtures.log_helper import log

# Enable verbose logging of all the traffic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a nit: it seems like we a couple of extra lines here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants