Skip to content

Commit 20ace61

Browse files
committed
Tweak complex test
This test is problematic on GitHub Actions because the build agents are SO SLOW.
1 parent f0f6b9a commit 20ace61

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/TinyIpc/Messaging/TinyMessageBus.Tests.cs

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Microsoft.Extensions.Options;
12
using Shouldly;
23
using TinyIpc.IO;
34
using TinyIpc.Synchronization;
@@ -77,10 +78,15 @@ public async Task All_messages_should_be_processed_even_with_multiple_buses_in_a
7778
var secondRound = 16;
7879
var total = firstRound + secondRound;
7980
var rnd = new Random();
81+
var options = new OptionsWrapper<TinyIpcOptions>(new TinyIpcOptions
82+
{
83+
// Use long lived messages in this test because GitHub Actions runners are SLOW
84+
MinMessageAge = TimeSpan.FromSeconds(5),
85+
});
8086

8187
// Start up two chatty buses talking to each other
82-
using var messagebus1 = new TinyMessageBus(name);
83-
using var messagebus2 = new TinyMessageBus(name);
88+
using var messagebus1 = new TinyMessageBus(name, options);
89+
using var messagebus2 = new TinyMessageBus(name, options);
8490

8591
var buses = new[] { messagebus1, messagebus2 };
8692

@@ -90,8 +96,12 @@ public async Task All_messages_should_be_processed_even_with_multiple_buses_in_a
9096
await buses[rnd.Next() % buses.Length].PublishAsync(messages, cancellationToken);
9197
}
9298

99+
// Force a read of all messages to work around timing issues
100+
await messagebus1.ReadAsync();
101+
await messagebus2.ReadAsync();
102+
93103
// Add a new bus to the mix
94-
using var messagebus3 = new TinyMessageBus(name);
104+
using var messagebus3 = new TinyMessageBus(name, options);
95105

96106
buses = [messagebus1, messagebus2, messagebus3];
97107

@@ -101,7 +111,7 @@ public async Task All_messages_should_be_processed_even_with_multiple_buses_in_a
101111
await buses[rnd.Next() % buses.Length].PublishAsync(messages, cancellationToken);
102112
}
103113

104-
// Force a final read of all messages to work around timing issuees
114+
// Force a final read of all messages to work around timing issues
105115
await messagebus1.ReadAsync();
106116
await messagebus2.ReadAsync();
107117
await messagebus3.ReadAsync();

0 commit comments

Comments
 (0)