Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/core/Akka.Streams.Tests/ActorMaterializerSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@

using System;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Pattern;
using Akka.Streams.Dsl;
using Akka.Streams.Implementation;
using Akka.TestKit;
using Akka.TestKit.Extensions;
using FluentAssertions;
using FluentAssertions.Extensions;
using Xunit;
using Xunit.Abstractions;

Expand All @@ -35,15 +38,15 @@ public void ActorMaterializer_should_report_shutdown_status_properly()
}

[Fact]
public void ActorMaterializer_should_properly_shut_down_actors_associated_with_it()
public async Task ActorMaterializer_should_properly_shut_down_actors_associated_with_it()
{
var m = Sys.Materializer();
var f = Source.Maybe<int>().RunAggregate(0, (x, y) => x + y, m);

m.Shutdown();

Action action = () => f.Wait(TimeSpan.FromSeconds(3));
action.Should().Throw<AbruptTerminationException>();
Func<Task> task = () => f.ShouldCompleteWithin(3.Seconds());
await task.Should().ThrowAsync<AbruptTerminationException>();
}

[Fact]
Expand All @@ -57,17 +60,17 @@ public void ActorMaterializer_should_refuse_materialization_after_shutdown()
}

[Fact]
public void ActorMaterializer_should_shut_down_supervisor_actor_it_encapsulates()
public async Task ActorMaterializer_should_shut_down_supervisor_actor_it_encapsulates()
{
var m = Sys.Materializer() as ActorMaterializerImpl;
var m = (ActorMaterializerImpl) Sys.Materializer();
Source.From(Enumerable.Empty<object>()).To(Sink.Ignore<object>()).Run(m);

m.Supervisor.Tell(StreamSupervisor.GetChildren.Instance);
ExpectMsg<StreamSupervisor.Children>();
await ExpectMsgAsync<StreamSupervisor.Children>();
m.Shutdown();

m.Supervisor.Tell(StreamSupervisor.GetChildren.Instance);
ExpectNoMsg(TimeSpan.FromSeconds(1));
await ExpectNoMsgAsync(TimeSpan.FromSeconds(1));
}

[Fact]
Expand Down
62 changes: 31 additions & 31 deletions src/core/Akka.Streams.Tests/Dsl/RestartSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public RestartSpec(ITestOutputHelper output)
// Source
//

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_run_normally()
{
this.AssertAllStagesStopped(() =>
Expand All @@ -71,7 +71,7 @@ public void A_restart_with_backoff_source_should_run_normally()
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_restart_on_completion()
{
this.AssertAllStagesStopped(() =>
Expand All @@ -95,7 +95,7 @@ public void A_restart_with_backoff_source_should_restart_on_completion()
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_restart_on_failure()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -125,7 +125,7 @@ public void A_restart_with_backoff_source_should_restart_on_failure()
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_backoff_before_restart()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -154,7 +154,7 @@ public void A_restart_with_backoff_source_should_backoff_before_restart()
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_reset_exponential_backoff_back_to_minimum_when_source_runs_for_at_least_minimum_backoff_without_completing()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -192,7 +192,7 @@ public void A_restart_with_backoff_source_should_reset_exponential_backoff_back_
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_cancel_the_currently_running_source_when_cancelled()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -221,7 +221,7 @@ public void A_restart_with_backoff_source_should_cancel_the_currently_running_so
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_not_restart_the_source_when_cancelled_while_backing_off()
{
this.AssertAllStagesStopped(() =>
Expand All @@ -244,7 +244,7 @@ public void A_restart_with_backoff_source_should_not_restart_the_source_when_can
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_stop_on_completion_if_it_should_only_be_restarted_in_failures()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -277,7 +277,7 @@ public void A_restart_with_backoff_source_should_stop_on_completion_if_it_should
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_restart_on_failure_when_only_due_to_failures_should_be_restarted()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -309,7 +309,7 @@ public void A_restart_with_backoff_source_should_restart_on_failure_when_only_du

// Flaky test, ExpectComplete times out with the default 3 seconds value under heavy load.
// Fail rate was 1:500
[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_not_restart_the_source_when_maxRestarts_is_reached()
{
this.AssertAllStagesStopped(() =>
Expand All @@ -332,7 +332,7 @@ public void A_restart_with_backoff_source_should_not_restart_the_source_when_max
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_reset_maxRestarts_when_source_runs_for_at_least_minimum_backoff_without_completing()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -364,7 +364,7 @@ public void A_restart_with_backoff_source_should_reset_maxRestarts_when_source_r
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_source_should_allow_using_withMaxRestarts_instead_of_minBackoff_to_determine_the_maxRestarts_reset_time()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -397,7 +397,7 @@ public void A_restart_with_backoff_source_should_allow_using_withMaxRestarts_ins
// Sink
//

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_sink_should_run_normally()
{
this.AssertAllStagesStopped(() =>
Expand All @@ -424,7 +424,7 @@ public void A_restart_with_backoff_sink_should_run_normally()
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_sink_should_restart_on_cancellation()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -456,7 +456,7 @@ public void A_restart_with_backoff_sink_should_restart_on_cancellation()
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_sink_should_backoff_before_restart()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -488,7 +488,7 @@ public void A_restart_with_backoff_sink_should_backoff_before_restart()
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_sink_should_reset_exponential_backoff_back_to_minimum_when_source_runs_for_at_least_minimum_backoff_without_completing()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -535,7 +535,7 @@ public void A_restart_with_backoff_sink_should_reset_exponential_backoff_back_to
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_sink_should_not_restart_the_sink_when_completed_while_backing_off()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -565,7 +565,7 @@ public void A_restart_with_backoff_sink_should_not_restart_the_sink_when_complet
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_sink_should_not_restart_the_sink_when_maxRestarts_is_reached()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -594,7 +594,7 @@ public void A_restart_with_backoff_sink_should_not_restart_the_sink_when_maxRest
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_sink_should_reset_maxRestarts_when_sink_runs_for_at_least_minimum_backoff_without_completing()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -634,7 +634,7 @@ public void A_restart_with_backoff_sink_should_reset_maxRestarts_when_sink_runs_
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_sink_should_allow_using_withMaxRestarts_instead_of_minBackoff_to_determine_the_maxRestarts_reset_time()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -743,7 +743,7 @@ private static Flow<TIn, TOut, NotUsed> RestartFlowFactory<TIn, TOut, TMat>(Func
return (created, source, flowInProbe, flowOutProbe, sink);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_run_normally()
{
this.AssertAllStagesStopped(() =>
Expand All @@ -765,7 +765,7 @@ public void A_restart_with_backoff_flow_should_run_normally()
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void Simplified_restart_flow_restarts_stages_test()
{
var created = new AtomicCounter(0);
Expand Down Expand Up @@ -829,7 +829,7 @@ public void Simplified_restart_flow_restarts_stages_test()
created.Current.Should().Be(restarts + 1);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_restart_on_cancellation()
{
var (created, source, flowInProbe, flowOutProbe, sink) = SetupFlow(_shortMinBackoff, _shortMaxBackoff);
Expand All @@ -854,7 +854,7 @@ public void A_restart_with_backoff_flow_should_restart_on_cancellation()
created.Current.Should().Be(2);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_restart_on_completion()
{
var (created, source, flowInProbe, flowOutProbe, sink) = SetupFlow(_shortMinBackoff, _shortMaxBackoff);
Expand All @@ -881,7 +881,7 @@ public void A_restart_with_backoff_flow_should_restart_on_completion()
created.Current.Should().Be(2);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_restart_on_failure()
{
var (created, source, flowInProbe, flowOutProbe, sink) = SetupFlow(_shortMinBackoff, _shortMaxBackoff);
Expand All @@ -906,7 +906,7 @@ public void A_restart_with_backoff_flow_should_restart_on_failure()
created.Current.Should().Be(2);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_backoff_before_restart()
{
var (created, source, flowInProbe, flowOutProbe, sink) = SetupFlow(_minBackoff, _maxBackoff);
Expand Down Expand Up @@ -935,7 +935,7 @@ public void A_restart_with_backoff_flow_should_backoff_before_restart()
created.Current.Should().Be(2);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_continue_running_flow_out_port_after_in_has_been_sent_completion()
{
this.AssertAllStagesStopped(() =>
Expand Down Expand Up @@ -964,7 +964,7 @@ public void A_restart_with_backoff_flow_should_continue_running_flow_out_port_af
}, Materializer);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_continue_running_flow_in_port_after_out_has_been_cancelled()
{
var (created, source, flowInProbe, flowOutProbe, sink) = SetupFlow(_shortMinBackoff, _maxBackoff);
Expand Down Expand Up @@ -1016,7 +1016,7 @@ public void A_restart_with_backoff_flow_should_not_restart_on_completion_when_ma
}

// onlyOnFailures
[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_stop_on_cancellation_when_using_onlyOnFailuresWithBackoff()
{
var (created, source, flowInProbe, flowOutProbe, sink) = SetupFlow(_shortMinBackoff, _shortMaxBackoff, -1, true);
Expand All @@ -1036,7 +1036,7 @@ public void A_restart_with_backoff_flow_should_stop_on_cancellation_when_using_o
created.Current.Should().Be(1);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_stop_on_completion_when_using_onlyOnFailuresWithBackoff()
{
var (created, source, flowInProbe, flowOutProbe, sink) = SetupFlow(_shortMinBackoff, _shortMaxBackoff, -1, true);
Expand All @@ -1053,7 +1053,7 @@ public void A_restart_with_backoff_flow_should_stop_on_completion_when_using_onl
created.Current.Should().Be(1);
}

[Fact]
[Fact(Skip = "Skipped for async_testkit conversion build")]
public void A_restart_with_backoff_flow_should_restart_on_failure_when_using_onlyOnFailuresWithBackoff()
{
var (created, source, flowInProbe, flowOutProbe, sink) = SetupFlow(_shortMinBackoff, _shortMaxBackoff, -1, true);
Expand Down