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

[WIP, ECO-4787] Prototype interception proxy #1816

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lawrence-forooghian
Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian commented Jul 16, 2024

As described in this internal RFC. Uses https://github.com/ably-labs/interception-proxy. See commit messages for more details.

@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 16, 2024 17:50 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 16, 2024 17:50 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 16, 2024 17:50 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from 66c568e to af3a497 Compare July 16, 2024 20:49
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 16, 2024 20:49 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 16, 2024 20:49 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 16, 2024 20:49 Inactive
@lawrence-forooghian lawrence-forooghian changed the title [WIP] Unified test suite: Prototype interception proxy [WIP, ECO-4787] Unified test suite: Prototype interception proxy Jul 16, 2024
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from af3a497 to bf8a5ce Compare July 25, 2024 09:39
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 25, 2024 09:40 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 25, 2024 09:40 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 25, 2024 09:40 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from bf8a5ce to cf1a729 Compare July 25, 2024 10:31
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 25, 2024 10:32 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 25, 2024 10:32 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 25, 2024 10:32 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from cf1a729 to 656f5b7 Compare July 29, 2024 09:30
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 29, 2024 09:31 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 29, 2024 09:31 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 29, 2024 09:31 Inactive
@lawrence-forooghian lawrence-forooghian changed the title [WIP, ECO-4787] Unified test suite: Prototype interception proxy [WIP, ECO-4787] Prototype interception proxy Jul 29, 2024
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from 656f5b7 to 14d00c3 Compare July 29, 2024 11:48
@lawrence-forooghian lawrence-forooghian changed the base branch from main to upgrade-prettier-and-run-on-everything July 29, 2024 11:48
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 29, 2024 11:49 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 29, 2024 11:49 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 29, 2024 11:49 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from 14d00c3 to 695f1e5 Compare July 30, 2024 07:49
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 30, 2024 07:50 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 30, 2024 09:59 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 30, 2024 09:59 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from 577bd41 to aa7871c Compare July 30, 2024 10:11
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 30, 2024 10:12 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 30, 2024 10:12 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 30, 2024 10:12 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from aa7871c to 67a1a7f Compare July 30, 2024 10:25
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 30, 2024 10:26 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 30, 2024 10:26 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 30, 2024 10:26 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from 67a1a7f to 86297af Compare July 30, 2024 10:29
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 30, 2024 10:30 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 30, 2024 10:30 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 30, 2024 10:30 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from 86297af to bdc7d36 Compare July 30, 2024 13:28
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report July 30, 2024 13:29 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/features July 30, 2024 13:29 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc July 30, 2024 13:29 Inactive
Base automatically changed from improve-test-server-error-handling to main August 1, 2024 08:08
@lawrence-forooghian lawrence-forooghian force-pushed the ECO-4787-prototype-interception-proxy branch from bdc7d36 to 7d07ad8 Compare September 24, 2024 18:30

This comment was marked as spam.

@github-actions github-actions bot temporarily deployed to staging/pull/1816/features September 24, 2024 18:30 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/bundle-report September 24, 2024 18:30 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1816/typedoc September 24, 2024 18:31 Inactive
This adds a client for the interception proxy, and passes all test
WebSocket traffic through the proxy. It does not currently perform any
modifications to the WebSocket traffic (I’ll add a subsequent commit
where we convert a handful of tests to use the proxy instead of private
APIs for intercepting and modifying Realtime protocol messages).

This is very much a prototype and work in progress, hence all the TODOs.
The API of InterceptionProxyClient will probably evolve as we convert
more tests to use it.

I’ve also added an NPM script called test:playwright:open-browser
script, which lets you open a headed browser which is configured to use
the interception proxy. Useful for local debugging of browser tests.

Here’s how to run the tests locally on macOS:

One-time setup:

1. Install the interception proxy’s Python dependencies (see readme of
   [1])

2. Run `npm install` to install the interception proxy

3. Generate mitmproxy TLS certificate:

   `npx --package interception-proxy generate-mitmproxy-certs`

Running the tests:

1. In a separate terminal, run the interception proxy (after each test
   run, you’ll need to kill this and run it again, which is a bit
   annoying; it would be good to fix this):

   `npx interception-proxy`

2. Run the tests:

   - Node:

     `NODE_EXTRA_CA_CERTS=~/.mitmproxy/mitmproxy-ca-cert.pem npm run test:node`

   - Browser: The easiest one is Firefox since it doesn’t require you to
     install any CA certificates:

     `PLAYWRIGHT_BROWSER=firefox npm run test:playwright`

[1] https://github.com/ably-labs/interception-proxy
I’ve changed these tests to use the interception proxy instead of
private API for intercepting and injecting Realtime protocol messages,
as an example of how to use the proxy and its test suite client class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant