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

Replaced TestUntil by AccessSafely #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Replaced TestUntil by AccessSafely #11

wants to merge 2 commits into from

Conversation

eliezio
Copy link

@eliezio eliezio commented Aug 8, 2019

No description provided.

@VaughnVernon
Copy link
Contributor

@eliezio Since @alexguzun was working in wire most recently, I prefer that he review your code. He is working near London this week and won't be back to Portugal until the weekend. I will do a review but I won't merge. I want Alex to approve and merge.

Copy link
Contributor

@VaughnVernon VaughnVernon left a comment

Choose a reason for hiding this comment

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

@eliezio Looks good to me. Will await @alexguzun to approve and merge.

Copy link
Contributor

@VaughnVernon VaughnVernon left a comment

Choose a reason for hiding this comment

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

@eliezio I think that the common base class test makes sense. It seems like a good idea to prove that the interfaces are appropriately implemented across different transport types. I approve but will await @alexguzun to approve and merge.

@VaughnVernon
Copy link
Contributor

@eliezio @alexguzun The Travis-CI build is failing on vlingo-wire with a timeout. This is generally due to a test not seeing the AccessSafely countdown reach zero. This may be due to an exception in test execution or that the number of expected steps is too high. Of course the countdown of expected steps might not reach zero due to another resource failure, such as network port availability. It's possible that the common test does not use a separate port for each test run, which is necessary for Socket and RSocket because the same port can be used by tests running in parallel, or there may be latency in closing the port prior to other tests attempting to use the same port. Here is the Travis-CI output:

io.rsocket.exceptions.RejectedSetupException: Channel could not be created

10:37:22.382 [main] INFO  io.vlingo.actors.Logger - RSocket client channel opened for address Address[Host[localhost],49243,NONE]

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received```

import static org.junit.Assert.assertEquals;

public abstract class AbstractServerChannelActorTest {
private static AtomicInteger TEST_PORT = new AtomicInteger(49560);
Copy link
Contributor

Choose a reason for hiding this comment

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

Each test, extending from this class, should have their own port range to avoid collision when running parallel tests .

Copy link
Author

Choose a reason for hiding this comment

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

Got it. Is it possible to use random ports on all tests, allowing a definitive solution for problems like this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Even a single static AtomicInteger and using incrementAndGet() in the abstract base will work for all extenders. I don't know why random would be better. You would still have to set ranges to different tests don't collide. I don't think there could be a central static because it could get recreated if multiple JVMs are employed in a given test run.

Copy link
Author

Choose a reason for hiding this comment

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

When I say random I mean letting the OS choose a random local port and configuring the client accordingly. This is a common failsafe practice on testing server applications.

Copy link
Contributor

Choose a reason for hiding this comment

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

I could not find any reliable way to do what you are suggesting with raw java.nio.channels.SocketChannel and io.rsocket.transport.netty.server.TcpServerTransport at the time. I think most of the frameworks simply loop through sockets until find one that's open. We could replicate the approach but it's prone to race conditions when the loop identifies a free socket, closes it, and the consumer did not yet attached to it.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Great find! Can you test this?

Copy link
Contributor

Choose a reason for hiding this comment

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

@alexguzun Can this be merged?

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.

3 participants