Example #1
0
        // test only
        internal virtual bool VerifyEquals(ActionStateBase other)
        {
            bool eq = (this.OperationId == other.OperationId) &&
                      (this.ActionType == other.ActionType) &&
                      (this.RollbackState == other.RollbackState) &&
                      (this.ErrorCausingRollback == other.ErrorCausingRollback);

            if (!eq)
            {
                TestabilityTrace.TraceSource.WriteError(TraceType, "OperationId ActionType RollbackState or ErrorCausingRollback does not match");
                return(false);
            }

            if (this.StateProgress.Count != other.StateProgress.Count)
            {
                TestabilityTrace.TraceSource.WriteError(TraceType, "StateProgress.Count does not match {0} vs {1}", this.StateProgress.Count, other.StateProgress.Count);
                return(false);
            }

            if (this.StateProgress.Count != 0)
            {
                if (this.StateProgress.Peek() != other.StateProgress.Peek())
                {
                    TestabilityTrace.TraceSource.WriteError(TraceType, "StateProgress.Peek does not match {0} vs {1}", this.StateProgress.Peek(), other.StateProgress.Peek());
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        public static StepBase GetStep(
            StepStateNames stateName,
            FabricClient fabricClient,
            ActionStateBase actionState,
            TestRetryStepAction action,
            TimeSpan requestTimeout,
            TimeSpan operationTimeout,
            CancellationToken cancellationToken)
        {
            StepBase step = null;

            if (stateName == StepStateNames.LookingUpState)
            {
                TestabilityTrace.TraceSource.WriteInfo(StepBase.TraceType, "{0} - constructing step (1)", actionState.OperationId);
                step = new TestRetryStepStepOne(fabricClient, actionState, requestTimeout, operationTimeout);
            }
            else if (stateName == StepStateNames.PerformingActions)
            {
                TestabilityTrace.TraceSource.WriteInfo(StepBase.TraceType, "{0} - constructing step (2)", actionState.OperationId);
                step = new TestRetryStepStepTwo(fabricClient, actionState, requestTimeout, operationTimeout);
            }
            else if (stateName == StepStateNames.CompletedSuccessfully)
            {
                // done - but then this method should not have been called
                ReleaseAssert.Failfast("GetStep() should not have been called when the state name is CompletedSuccessfully");
            }
            else
            {
                ReleaseAssert.Failfast(string.Format(CultureInfo.InvariantCulture, "Unexpected state name={0}", stateName));
            }

            return(step);
        }
 public override StepBase GetStep(
     FabricClient fabricClient,
     ActionStateBase actionState,
     StepStateNames stateName,
     CancellationToken cancellationToken)
 {
     return(StopNodeStepsFactory.GetStep(stateName, fabricClient, actionState, this, this.RequestTimeout, this.OperationTimeout, cancellationToken));
 }
Example #4
0
 public override StepBase GetStep(
     FabricClient fabricClient,
     ActionStateBase actionState,
     StepStateNames stateName,
     CancellationToken cancellationToken)
 {
     return(new StuckStep(fabricClient, actionState, this.RequestTimeout, this.OperationTimeout));
 }
Example #5
0
        public StepBase(FabricClient fabricClient, ActionStateBase stepState, TimeSpan requestTimeout, TimeSpan operationTimeout)
        {
            ReleaseAssert.AssertIf(fabricClient == null, "fabricClient should not be null");
            ReleaseAssert.AssertIf(stepState == null, "'stepState' should not be null");

            this.FabricClient     = fabricClient;
            this.State            = stepState;
            this.RequestTimeout   = requestTimeout;
            this.OperationTimeout = operationTimeout;
        }
        public static TestRetryStepState Convert(ActionStateBase actionState)
        {
            TestRetryStepState testRetryStepState = actionState as TestRetryStepState;

            if (testRetryStepState == null)
            {
                throw new InvalidCastException("State object could not be converted");
            }

            return(testRetryStepState);
        }
        // test only
        internal override bool VerifyEquals(ActionStateBase other)
        {
            InvokeDataLossState state = other as InvokeDataLossState;

            if (state == null)
            {
                return(false);
            }

            if (!base.VerifyEquals(other))
            {
                return(false);
            }

            return(this.Info.VerifyEquals(state.Info));
        }
        // test only
        internal override bool VerifyEquals(ActionStateBase other)
        {
            RestartPartitionState state = other as RestartPartitionState;

            if (state == null)
            {
                return(false);
            }

            if (!base.VerifyEquals(other))
            {
                return(false);
            }

            return(this.Info.VerifyEquals(state.Info));
        }
 public TestRetryStepStepOne(FabricClient fabricClient, ActionStateBase state, TimeSpan requestTimeout, TimeSpan operationTimeout)
     : base(fabricClient, state, requestTimeout, operationTimeout)
 {
 }
Example #10
0
 public StuckStep(FabricClient fabricClient, ActionStateBase state, TimeSpan requestTimeout, TimeSpan operationTimeout)
     : base(fabricClient, state, requestTimeout, operationTimeout)
 {
 }