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 bidirectional tests #607
Conversation
aa9bf68
to
6431b54
Compare
await Task.WhenAll(t1, t2); | ||
sw.Stop(); | ||
|
||
sw.ElapsedMilliseconds.Should().BeLessThan(await t1 + await t2); |
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.
It may be worth replacing the timing to test concurrency by using a "do some action service" and having that action service wait until both requests are in flight before returning.
The tests are run in parallel so the load tends to cause tests with timings to occasionally fail. Sometimes we make those tests run as non parallel but that just means it takes longer to run the tests :(
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.
have converted the quick POC hack towards something that is hopefully more reliable
{ | ||
await SetupBiDirectionalClients(async (octopusEchoClient, tentacleEchoClient) => | ||
{ | ||
var t1 = Task.Run(async () => await RunEchoTask(octopusEchoClient)).WithTimeout(TimeSpan.FromSeconds(5)); |
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.
What is the intent of the timeout? The base class should be providing a timeout on the test if the concern is this will run forever.
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.
👍 I've update the timeout limits for use in the test,
await SetupBiDirectionalPollingClients(async (clientServiceA, clientServiceB) => | ||
{ | ||
MyEchoService.SharedState = 0; | ||
var taskA = clientServiceA.BlockWaitingForSharedStateIncrementAsync().WithCancellation(CancellationToken); |
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.
This should prevent random race conditions when we run the tests in parallel thanks!
Simple test confirming once a connection is established the service messaging layer is bi-directional