Skip to content
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

harden timing on racy Akka.Streams specs #6397

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/core/Akka.Streams.Tests/Dsl/AsyncEnumerableSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ await foreach (var _ in task)
materializer.Shutdown();
}
});

//since we are collapsing the stream inside the read
//we want to send messages so we aren't just waiting forever.
await probe.SendNextAsync(1);
await probe.SendNextAsync(2);
var thrown = false;
try
{
await a.ShouldCompleteWithin(3.Seconds());
await a.ShouldCompleteWithin(10.Seconds());
}
catch (StreamDetachedException)
{
Expand Down
14 changes: 8 additions & 6 deletions src/core/Akka.Streams.Tests/Dsl/HubSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,16 @@ public async Task MergeHub_must_keep_working_even_if_one_of_the_producers_fail()
{
var (sink, task) = MergeHub.Source<int>(16).Take(10).ToMaterialized(Sink.Seq<int>(), Keep.Both).Run(Materializer);

await EventFilter.Error(contains: "Upstream producer failed with exception").ExpectOneAsync(async () =>
await WithinAsync(10.Seconds(), async () =>
{
Source.Failed<int>(new TestException("failing")).RunWith(sink, Materializer);
Source.From(Enumerable.Range(1, 10)).RunWith(sink, Materializer);
var result = await task.ShouldCompleteWithin(3.Seconds());
result.Should().BeEquivalentTo(Enumerable.Range(1, 10));
await EventFilter.Error(contains: "Upstream producer failed with exception").ExpectOneAsync(async () =>
{
Source.Failed<int>(new TestException("failing")).RunWith(sink, Materializer);
Source.From(Enumerable.Range(1, 10)).RunWith(sink, Materializer);
var result = await task.ShouldCompleteWithin(3.Seconds());
result.Should().BeEquivalentTo(Enumerable.Range(1, 10));
});
});

}, Materializer);
}

Expand Down