Skip to content

Conversation

Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Mar 19, 2025

Changes

Discovered while debugging one of the MergeHub specs that a 10s timeout from a WithinAsync block was not being passed to the EventFilter.ExpectOneAsync method, which instead timed out to 3s.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

@Aaronontheweb Aaronontheweb added confirmed bug akka-testkit Akka.NET Testkit issues labels Mar 19, 2025
@Aaronontheweb Aaronontheweb added this to the 1.5.40 milestone Mar 19, 2025
Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

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

Detailed my changes

*/
const double epsilonPercentage = 0.15; // 15% fudge factor
const double minimumEpsilonValueMs = 50.0d; // 50ms minimum epsilon value
epsilonValue ??= TimeSpan.FromMilliseconds(Math.Max(max.TotalMilliseconds * epsilonPercentage, minimumEpsilonValueMs));
Copy link
Member Author

Choose a reason for hiding this comment

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

Calculate a default epsilon value

}
else
{
timeoutValue = _testkit.RemainingOrDefault;
Copy link
Member Author

Choose a reason for hiding this comment

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

Make sure we use any time values set by Within / WithinAsync

@Aaronontheweb
Copy link
Member Author

I threw some TBD removals in here while I was poking around, since the test suite that was failing as a result of my first set of changes (have EventFilter respect Within settings) was Akka.Cluster.Tests

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

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

Left some questions

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

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

LGTM

@Arkatufus Arkatufus enabled auto-merge (squash) March 20, 2025 12:52
@Aaronontheweb
Copy link
Member Author

Akka.TestKit.Tests.TestKitBaseTests.WithinTests.Within_should_increase_max_timeout_by_the_provided_epsilon_value

Failed: Block took 00:00:01.1694737, exceeding 00:00:01.

   at Akka.TestKit.TestKitBase.<WithinAsync>d__223`1.MoveNext() in D:\a\1\s\src\core\Akka.TestKit\TestKitBase_Within.cs:line 347
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Akka.TestKit.TestKitBase.Within(TimeSpan max, Action action, Nullable`1 epsilonValue, CancellationToken cancellationToken) in D:\a\1\s\src\core\Akka.TestKit\TestKitBase_Within.cs:line 51
   at Akka.TestKit.Tests.TestKitBaseTests.WithinTests.Within_should_increase_max_timeout_by_the_provided_epsilon_value() in D:\a\1\s\src\core\Akka.TestKit.Tests\TestKitBaseTests\WithinTests.cs:line 25

Guess I'm going to need to look at that test too - first time I've seen it fail in 30-something attempts

@Aaronontheweb Aaronontheweb modified the milestones: 1.5.40, 1.5.41 Mar 24, 2025
This was referenced Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

akka-testkit Akka.NET Testkit issues confirmed bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants