Skip to content

Commit

Permalink
Disable racy Remoting and Core specs (#4256)
Browse files Browse the repository at this point in the history
* disabled Ask_does_not_deadlock spec

* Delete Bug3370DotNettyLinuxBufferPoolSpec.cs

Deleted since #4252 eliminated need for this

* relaxing timeout on FSMTimingSpec
  • Loading branch information
Aaronontheweb committed Feb 26, 2020
1 parent c102dd9 commit c867e13
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 141 deletions.
8 changes: 4 additions & 4 deletions src/core/Akka.Remote.Tests/RemotingSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ public async Task Remoting_must_support_Ask()
//TODO: using smaller numbers for the cancellation here causes a bug.
//the remoting layer uses some "initialdelay task.delay" for 4 seconds.
//so the token is cancelled before the delay completed..
var msg = await _here.Ask<(string, IActorRef)>("ping", TimeSpan.FromSeconds(1.5));
Assert.Equal("pong", msg.Item1);
Assert.IsType<FutureActorRef>(msg.Item2);
var (msg, actorRef) = await _here.Ask<(string, IActorRef)>("ping", TimeSpan.FromSeconds(1.5));
Assert.Equal("pong", msg);
Assert.IsType<FutureActorRef>(actorRef);
}

[Fact]
[Fact(Skip = "Racy")]
public async Task Ask_does_not_deadlock()
{
// see https://github.com/akkadotnet/akka.net/issues/2546
Expand Down

This file was deleted.

88 changes: 44 additions & 44 deletions src/core/Akka.Tests/Actor/FSMTimingSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ namespace Akka.Tests.Actor
{
public class FSMTimingSpec : AkkaSpec
{
public IActorRef fsm { get; }
public IActorRef FSM { get; }

public FSMTimingSpec()
{
fsm = Sys.ActorOf(Props.Create(() => new StateMachine(TestActor)), "fsm");
fsm.Tell(new SubscribeTransitionCallBack(TestActor));
ExpectMsg(new CurrentState<FsmState>(fsm, FsmState.Initial), 1.Seconds());
FSM = Sys.ActorOf(Props.Create(() => new StateMachine(TestActor)), "fsm");
FSM.Tell(new SubscribeTransitionCallBack(TestActor));
ExpectMsg(new CurrentState<FsmState>(FSM, FsmState.Initial));
}

[Fact]
Expand All @@ -35,9 +35,9 @@ public void FSM_must_receive_StateTimeout()
{
Within(500.Milliseconds(), 1.Seconds(), () =>
{
fsm.Tell(FsmState.TestStateTimeout);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestStateTimeout));
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestStateTimeout, FsmState.Initial));
FSM.Tell(FsmState.TestStateTimeout);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestStateTimeout));
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestStateTimeout, FsmState.Initial));
});
ExpectNoMsg(50.Milliseconds());
});
Expand All @@ -48,11 +48,11 @@ public void FSM_must_cancel_a_StateTimeout()
{
Within(1.Seconds(), () =>
{
fsm.Tell(FsmState.TestStateTimeout);
fsm.Tell(Cancel.Instance);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestStateTimeout));
FSM.Tell(FsmState.TestStateTimeout);
FSM.Tell(Cancel.Instance);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestStateTimeout));
ExpectMsg<Cancel>();
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestStateTimeout, FsmState.Initial));
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestStateTimeout, FsmState.Initial));
ExpectNoMsg(50.Milliseconds());
});
}
Expand All @@ -76,16 +76,16 @@ public void FSM_must_allow_StateTimeout_override()
//the timeout in state TestStateTimeout is 800ms, then it will change back to Initial
Within(400.Milliseconds(), () =>
{
fsm.Tell(FsmState.TestStateTimeoutOverride);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestStateTimeout));
FSM.Tell(FsmState.TestStateTimeoutOverride);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestStateTimeout));
ExpectNoMsg(300.Milliseconds());
});

Within(1.Seconds(), () =>
{
fsm.Tell(Cancel.Instance);
FSM.Tell(Cancel.Instance);
ExpectMsg<Cancel>();
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestStateTimeout, FsmState.Initial));
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestStateTimeout, FsmState.Initial));
});
}

Expand All @@ -96,10 +96,10 @@ public void FSM_must_receive_single_shot_timer()
{
Within(500.Milliseconds(), 1.Seconds(), () =>
{
fsm.Tell(FsmState.TestSingleTimer);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestSingleTimer));
FSM.Tell(FsmState.TestSingleTimer);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestSingleTimer));
ExpectMsg<Tick>();
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestSingleTimer, FsmState.Initial));
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestSingleTimer, FsmState.Initial));
});
ExpectNoMsg(500.Milliseconds());
});
Expand All @@ -112,15 +112,15 @@ public void FSM_must_resubmit_single_shot_timer()
{
Within(500.Milliseconds(), 1.Seconds(), () =>
{
fsm.Tell(FsmState.TestSingleTimerResubmit);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestSingleTimerResubmit));
FSM.Tell(FsmState.TestSingleTimerResubmit);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestSingleTimerResubmit));
ExpectMsg<Tick>();
});
Within(1.Seconds(), () =>
{
ExpectMsg<Tock>();
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestSingleTimerResubmit, FsmState.Initial));
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestSingleTimerResubmit, FsmState.Initial));
});
ExpectNoMsg(500.Milliseconds());
});
Expand All @@ -129,45 +129,45 @@ public void FSM_must_resubmit_single_shot_timer()
[Fact]
public void FSM_must_correctly_cancel_a_named_timer()
{
fsm.Tell(FsmState.TestCancelTimer);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestCancelTimer));
FSM.Tell(FsmState.TestCancelTimer);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestCancelTimer));
Within(500.Milliseconds(), () =>
{
fsm.Tell(Tick.Instance);
FSM.Tell(Tick.Instance);
ExpectMsg<Tick>();
});

Within(300.Milliseconds(), 1.Seconds(), () =>
{
ExpectMsg<Tock>();
});
fsm.Tell(Cancel.Instance);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestCancelTimer, FsmState.Initial), 1.Seconds());
FSM.Tell(Cancel.Instance);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestCancelTimer, FsmState.Initial), 1.Seconds());
}

[Fact]
public void FSM_must_not_get_confused_between_named_and_state_timers()
{
fsm.Tell(FsmState.TestCancelStateTimerInNamedTimerMessage);
fsm.Tell(Tick.Instance);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestCancelStateTimerInNamedTimerMessage));
FSM.Tell(FsmState.TestCancelStateTimerInNamedTimerMessage);
FSM.Tell(Tick.Instance);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestCancelStateTimerInNamedTimerMessage));
ExpectMsg<Tick>(500.Milliseconds());
Task.Delay(200.Milliseconds());
Resume(fsm);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestCancelStateTimerInNamedTimerMessage, FsmState.TestCancelStateTimerInNamedTimerMessage2), 500.Milliseconds());
fsm.Tell(Cancel.Instance);
Resume(FSM);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestCancelStateTimerInNamedTimerMessage, FsmState.TestCancelStateTimerInNamedTimerMessage2), 500.Milliseconds());
FSM.Tell(Cancel.Instance);
Within(500.Milliseconds(), () =>
{
ExpectMsg<Cancel>();
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestCancelStateTimerInNamedTimerMessage2, FsmState.Initial));
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestCancelStateTimerInNamedTimerMessage2, FsmState.Initial));
});
}

[Fact]
public void FSM_must_receive_and_cancel_a_repeated_timer()
{
fsm.Tell(FsmState.TestRepeatedTimer);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestRepeatedTimer));
FSM.Tell(FsmState.TestRepeatedTimer);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestRepeatedTimer));
var seq = ReceiveWhile(2.Seconds(), o =>
{
if (o is Tick)
Expand All @@ -177,7 +177,7 @@ public void FSM_must_receive_and_cancel_a_repeated_timer()
seq.Should().HaveCount(5);
Within(500.Milliseconds(), () =>
{
ExpectMsg(new Transition<FsmState>(fsm, FsmState.TestRepeatedTimer, FsmState.Initial));
ExpectMsg(new Transition<FsmState>(FSM, FsmState.TestRepeatedTimer, FsmState.Initial));
});
}

Expand All @@ -191,18 +191,18 @@ public void FSM_must_notify_unhandled_messages()
// .ExpectOne(
// () =>
// {
fsm.Tell(FsmState.TestUnhandled);
ExpectMsg(new Transition<FsmState>(fsm, FsmState.Initial, FsmState.TestUnhandled));
FSM.Tell(FsmState.TestUnhandled);
ExpectMsg(new Transition<FsmState>(FSM, FsmState.Initial, FsmState.TestUnhandled));
Within(3.Seconds(), () =>
{
fsm.Tell(Tick.Instance);
fsm.Tell(SetHandler.Instance);
fsm.Tell(Tick.Instance);
FSM.Tell(Tick.Instance);
FSM.Tell(SetHandler.Instance);
FSM.Tell(Tick.Instance);
ExpectMsg<Unhandled>().Msg.Should().BeOfType<Tick>();
fsm.Tell(new Unhandled("test"));
fsm.Tell(Cancel.Instance);
FSM.Tell(new Unhandled("test"));
FSM.Tell(Cancel.Instance);
var transition = ExpectMsg<Transition<FsmState>>();
transition.FsmRef.Should().Be(fsm);
transition.FsmRef.Should().Be(FSM);
transition.From.Should().Be(FsmState.TestUnhandled);
transition.To.Should().Be(FsmState.Initial);
});
Expand Down

0 comments on commit c867e13

Please sign in to comment.