Skip to content

Commit

Permalink
Increase timeouts in PeerDirectoryClientTests
Browse files Browse the repository at this point in the history
  • Loading branch information
ocoanet committed Sep 16, 2022
1 parent fa5c170 commit b1eb35a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Abc.Zebus.Tests/Directory/PeerDirectoryClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

namespace Abc.Zebus.Tests.Directory
{
// WARN: in the tests, do not reuse the same PeerDescriptor instance multiple times when calling PeerDirectoryClient methods,
// you might end up with a test passing by coincidence

/// <remarks>
/// Do not reuse the same PeerDescriptor instance multiple times when calling PeerDirectoryClient methods,
/// you might end up with a test passing by coincidence.
/// </remarks>
[TestFixture]
public partial class PeerDirectoryClientTests
{
Expand Down Expand Up @@ -151,7 +152,7 @@ public async Task should_not_use_failing_directory_peer_twice_for_register([Valu
var failingDirectoryId = new PeerId("Abc.Zebus.DirectoryService.0");

_configuration.IsDirectoryPickedRandomly = true;
_configuration.RegistrationTimeout = 500.Milliseconds();
_configuration.RegistrationTimeout = 1.Second(); // Makes test slower but more robust (for CI/GH)

_bus.HandlerExecutor = new TestBus.AsyncHandlerExecutor();
_bus.AddHandlerForPeer<RegisterPeerCommand>(failingDirectoryId, _ => HandleCommandOnFailingDirectory());
Expand All @@ -174,7 +175,7 @@ RegisterPeerResponse HandleCommandOnFailingDirectory()
if (failureMode == DirectoryFailureMode.Error)
throw new Exception("Bad directory!");

Thread.Sleep(2.Seconds());
Thread.Sleep(3.Seconds());
return new RegisterPeerResponse(Array.Empty<PeerDescriptor>());
}
}
Expand All @@ -185,7 +186,7 @@ public async Task should_reuse_failing_directory_peer_after_delay_for_register([
// Arrange
var failingDirectoryId = new PeerId("Abc.Zebus.DirectoryService.0");

_configuration.RegistrationTimeout = 500.Milliseconds();
_configuration.RegistrationTimeout = 1.Second(); // Makes test slower but more robust (for CI/GH)

_bus.HandlerExecutor = new TestBus.AsyncHandlerExecutor();
_bus.AddHandlerForPeer<RegisterPeerCommand>(failingDirectoryId, _ => HandleCommandOnFailingDirectory());
Expand Down Expand Up @@ -223,7 +224,7 @@ RegisterPeerResponse HandleCommandOnFailingDirectory()
if (failureMode == DirectoryFailureMode.Error)
throw new Exception("Bad directory!");

Thread.Sleep(2.Seconds());
Thread.Sleep(3.Seconds());
return new RegisterPeerResponse(Array.Empty<PeerDescriptor>());
}
}
Expand All @@ -235,7 +236,7 @@ public async Task should_not_use_failing_directory_peer_twice_for_subscriptions(
var failingDirectoryId = new PeerId("Abc.Zebus.DirectoryService.0");

_configuration.IsDirectoryPickedRandomly = true;
_configuration.RegistrationTimeout = 500.Milliseconds();
_configuration.RegistrationTimeout = 1.Second(); // Makes test slower but more robust (for CI/GH)

_bus.HandlerExecutor = new TestBus.AsyncHandlerExecutor();
_bus.AddHandlerForPeer<UpdatePeerSubscriptionsForTypesCommand>(failingDirectoryId, _ => HandleCommandOnFailingDirectory());
Expand Down

0 comments on commit b1eb35a

Please sign in to comment.