Example #1
0
 public void RetrierInTaskState_IntervalSecondsZero_IsNotValid()
 {
     Assert.Throws <ValidationException>(() =>
                                         StateMachineBuilder.StateMachine()
                                         .StartAt("Initial")
                                         .State("Initial", StateMachineBuilder.TaskState()
                                                .Transition(StateMachineBuilder.End())
                                                .Retrier(StateMachineBuilder.Retrier()
                                                         .IntervalSeconds(0)
                                                         .RetryOnAllErrors())
                                                .Resource("arn"))
                                         .Build());
 }
Example #2
0
 public void RetrierInTaskState_MaxAttemptsNegative_IsNotValid()
 {
     Assert.Throws <ValidationException>(() =>
                                         StateMachineBuilder.StateMachine()
                                         .StartAt("Initial")
                                         .State("Initial", StateMachineBuilder.TaskState()
                                                .Transition(StateMachineBuilder.End())
                                                .Retrier(StateMachineBuilder.Retrier()
                                                         .MaxAttempts(-1)
                                                         .RetryOnAllErrors())
                                                .Resource("arn"))
                                         .Build());
 }
Example #3
0
 public void ParallelStateInvalidRetrier_IsNotValid()
 {
     Assert.Throws <ValidationException>(() =>
                                         StateMachineBuilder.StateMachine()
                                         .StartAt("Initial")
                                         .State("Initial", StateMachineBuilder.ParallelState()
                                                .Branch(StateMachineBuilder.SubStateMachine()
                                                        .StartAt("InitialBranchState")
                                                        .State("InitialBranchState", StateMachineBuilder.SucceedState()))
                                                .Transition(StateMachineBuilder.End())
                                                .Retrier(StateMachineBuilder.Retrier()
                                                         .IntervalSeconds(-1)))
                                         .Build());
 }
Example #4
0
 public void RetrierInTaskState_RetryAllIsNotLastRetrier_IsNotValid()
 {
     Assert.Throws <ValidationException>(() =>
                                         StateMachineBuilder.StateMachine()
                                         .StartAt("Initial")
                                         .State("Initial", StateMachineBuilder.TaskState()
                                                .Transition(StateMachineBuilder.End())
                                                .Retrier(StateMachineBuilder.Retrier()
                                                         .RetryOnAllErrors())
                                                .Retrier(StateMachineBuilder.Retrier()
                                                         .ErrorEquals("Foo", "Bar"))
                                                .Resource("arn"))
                                         .Build());
 }
Example #5
0
        public void SingleTaskStateWithRetries()
        {
            var stateMachine = StateMachineBuilder.StateMachine()
                               .StartAt("InitialState")
                               .State("InitialState", StateMachineBuilder.TaskState()
                                      .Transition(StateMachineBuilder.Next("NextState"))
                                      .Resource("resource-arn")
                                      .Retriers(StateMachineBuilder.Retrier()
                                                .ErrorEquals("Foo", "Bar")
                                                .IntervalSeconds(20)
                                                .MaxAttempts(3)
                                                .BackoffRate(2.0),
                                                StateMachineBuilder.Retrier()
                                                .RetryOnAllErrors()
                                                .IntervalSeconds(30)
                                                .MaxAttempts(10)
                                                .BackoffRate(2.0)))
                               .State("NextState", StateMachineBuilder.SucceedState())
                               .Build();

            AssertStateMachine(stateMachine, "SimpleTaskStateWithRetries.json");
        }