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 {Bun,Node}HttpServer.layerTest for testing http servers #3409

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

sukovanej
Copy link
Contributor

@sukovanej sukovanej commented Aug 4, 2024

POC of http testing modules, it is introducing three new modules

  • NodeHttpTest and BunHttpTest - exposing layers enabling live testing of http apps, I have similar implementation in the effect-http package, and one implementation was already used in the test suite for /platform-node so this is only about exposing this functionality for convenient testing in the user-land
  • HttpTest exposing layers for "in-memory" testing of http apps, it mimics the client <> server comm using a queue, there's an implementation of request / response classes enabling conversions client request -> server request and server response -> client response and finally layers with the implementation of HttpClient and HttpServer that exchange requests / responses through the queue and map the requests / responses.

UPDATE: the in-memory implementation was removed and this PR now introduces only the live testing layers.

Copy link

changeset-bot bot commented Aug 4, 2024

🦋 Changeset detected

Latest commit: 9917b61

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@effect/platform-node Patch
@effect/platform-bun Patch
@effect/platform Patch
@effect/cli Patch
@effect/cluster-browser Patch
@effect/cluster-node Patch
@effect/cluster-workflow Patch
@effect/cluster Patch
@effect/experimental Patch
@effect/rpc-http Patch
@effect/platform-browser Patch
@effect/platform-node-shared Patch
@effect/rpc Patch
@effect/sql-d1 Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-node Patch
@effect/sql Patch
@effect/sql-drizzle Patch
@effect/sql-kysely Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sukovanej
Copy link
Contributor Author

@tim-smart could you please take a look and give me some feedback? I'd like to know what you think about this in general so I can decide whether to move forward with it.

Copy link
Member

@tim-smart tim-smart left a comment

Choose a reason for hiding this comment

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

I think the test live layers are a good addition - I think we can just add them to the HttpServer modules as layerTest.

Not sure about the in-memory addition. Maybe add those changes in a separate PR and we can discuss there.

@@ -0,0 +1,24 @@
/**
* @since 0.41.3
Copy link
Member

Choose a reason for hiding this comment

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

If you keep all the since tags at 1.0.0, as we are not yet api stable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it. I noticed Giulio uses precise @since versions in the /schema and I think it's beneficial for the consumers of the lib.

packages/platform-node/src/NodeHttpTest.ts Outdated Show resolved Hide resolved
packages/platform/src/internal/httpInMemoryMessage.ts Outdated Show resolved Hide resolved
packages/platform/src/HttpTest.ts Outdated Show resolved Hide resolved
packages/platform/src/HttpTest.ts Outdated Show resolved Hide resolved
@sukovanej
Copy link
Contributor Author

Thanks for the feedback. I removed the in-memory impl from this PR and adjusted.

@sukovanej sukovanej changed the title http testing modules introduce http testing layers Aug 6, 2024
@sukovanej sukovanej marked this pull request as ready for review August 6, 2024 10:03
@tim-smart tim-smart changed the title introduce http testing layers add {Bun,Node}HttpServer.layerTest for testing http servers Aug 7, 2024
@tim-smart tim-smart merged commit 056b710 into Effect-TS:main Aug 7, 2024
11 checks passed
@github-actions github-actions bot mentioned this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants