-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
tests(rust): fix flaky transport tests #2726
Conversation
23a7535
to
51a548b
Compare
Can we not have the operating system assign us a port number by using 0? |
We should be able to by modifying the Thanks for the tip @twittner! |
de092fe
to
c960373
Compare
I've added the changes suggested by @twittner to remove the "random port" logic altogether. |
How do we manage to collide picking random port from 10000 to 65535? |
e7de132
to
1dc5665
Compare
In my case, I had some os processes running on ports 19455, 42849 and 50586. I don't know if a similar case could happen in CI, but knowing what ports are available is out of our control I guess, so it should be best if we can assign a port automatically by the os. Also if tests were to be run in parallel, chances would definitely be there, although this fix won't solve the problem toralf outlined here: #2730.
Sure, done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
implementations/rust/ockam/ockam_transport_tcp/tests/send_receive.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, one fix is required though
implementations/rust/ockam/ockam_transport_tcp/src/transport.rs
Outdated
Show resolved
Hide resolved
e4c823e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrianbenavides It looks like commitlint
ignores commits of the form:
Revert "test(rust): fix flaky transport tests"
That was surprising to me. We should add some overriding lints tests for it.
Since in out workflow commits get rebased and moved around, its better to avoid referring to older commits and instead just describe the change that is in a patch/commit.
Transport tests that were using a random port to create the "listener" sides were failing when the selected port was already used by another process. These changes add a loop to retry binding a transport until it succeeds. It also adds a small change to the `test` macro so that we don't have to explicitly stop the context at the end of every test.
To reduce boilerplate in tests to get a random port to bind to, now the router's `bind` method return the socket address that was used. This can be useful when binding to port 0.
e4c823e
to
c85ea3b
Compare
c85ea3b
to
089d48c
Compare
Yeah, I didn't think about changing the auto-generated message after the revert. I've changed it now! |
try to see what is the best way one approver can grant an okay after changes were requested by another approver.
Transport tests that were using a random port to create the "listener" sides were failing when the selected port was already used by another process. These changes add a loop to retry binding a transport until it succeeds.
It also adds a small change to the
test
macro so that we don't have to explicitly stop the context at the end of every test.Fixes #2720