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

fix(client_tests): Fix port collisions #1223

Merged
merged 3 commits into from May 14, 2024

Conversation

davidmartos96
Copy link
Contributor

We found that the PG ports can collide in 2 of the tests.
We've also included a way to automatically assign a port to the client tests http server, as we've sometimes found some flakiness with the fixed port being used already.

async start(): Promise<number> {
return new Promise((res) => {
this.httpServer.listen(() => {
const address = this.httpServer.address()
Copy link
Contributor

Choose a reason for hiding this comment

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

I would fetch the port directly on this line than there is no need for import { AddressInfo } from 'net' and for the cast on the line below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could remove the cast, but then we would need to do (address() as any).port because it returns union type to take into account the different ways a server can be started.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, nevermind. Let's keep it as is than, i prefer a cast to AddressInfo instead of any. Thanks for clarifying!

@kevin-dp
Copy link
Contributor

Thanks for reporting and fixing the potential port clash. All looks good to me, left a very minor comment that we could fix before i merge it. Thanks!

@kevin-dp
Copy link
Contributor

@davidmartos96 can you add a changeset please, then i can merge :-)

@davidmartos96
Copy link
Contributor Author

@kevin-dp Done!

@kevin-dp kevin-dp merged commit 6080c9c into electric-sql:main May 14, 2024
8 of 10 checks passed
@davidmartos96 davidmartos96 deleted the fix_port branch May 14, 2024 10:37
alco pushed a commit that referenced this pull request May 19, 2024
We found that the PG ports can collide in 2 of the tests.
We've also included a way to automatically assign a port to the client
tests http server, as we've sometimes found some flakiness with the
fixed port being used already.
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.

None yet

2 participants