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()); }
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()); }
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()); }
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()); }
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"); }