From b1eb35a6d538d6085374e0422cafc9785eede172 Mon Sep 17 00:00:00 2001 From: Olivier Coanet Date: Fri, 16 Sep 2022 11:01:26 +0200 Subject: [PATCH] Increase timeouts in PeerDirectoryClientTests --- .../Directory/PeerDirectoryClientTests.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Abc.Zebus.Tests/Directory/PeerDirectoryClientTests.cs b/src/Abc.Zebus.Tests/Directory/PeerDirectoryClientTests.cs index 893ed276..260e2a29 100644 --- a/src/Abc.Zebus.Tests/Directory/PeerDirectoryClientTests.cs +++ b/src/Abc.Zebus.Tests/Directory/PeerDirectoryClientTests.cs @@ -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 - + /// + /// Do not reuse the same PeerDescriptor instance multiple times when calling PeerDirectoryClient methods, + /// you might end up with a test passing by coincidence. + /// [TestFixture] public partial class PeerDirectoryClientTests { @@ -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(failingDirectoryId, _ => HandleCommandOnFailingDirectory()); @@ -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()); } } @@ -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(failingDirectoryId, _ => HandleCommandOnFailingDirectory()); @@ -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()); } } @@ -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(failingDirectoryId, _ => HandleCommandOnFailingDirectory());