Example #1
0
        private void InitializeCategoryWeights()
        {
            this.faultCategoryChooser  = new WeightedDice <FaultCategory>(this.Random);
            this.actionCategoryChooser = new WeightedDice <ActionCategory>(this.Random);

            // Add a dice-face for NodeFaults
            this.faultCategoryChooser.AddNewFace(FaultCategory.NodeFaults, this.testParameters.NodeFaultActionWeight);

            // Add a dice-face for ServiceFaults
            this.faultCategoryChooser.AddNewFace(FaultCategory.ServiceFaults, this.testParameters.ServiceFaultActionWeight);

            this.faultCategoryChooser.AddNewFace(FaultCategory.SystemFaults, this.testParameters.SystemFaultActionWeight);

            var faultActionCategoryWeight = this.testParameters.NodeFaultActionWeight + this.testParameters.ServiceFaultActionWeight + this.testParameters.SystemFaultActionWeight;

            this.actionCategoryChooser.AddNewFace(
                ActionCategory.Faults,
                faultActionCategoryWeight);

            // Add a new face(outcome value) for workloads action manager.
            // Weight of action-manager that is all workloads collectively, is multiplied with weight of one workload.
            this.actionCategoryChooser.AddNewFace(
                ActionCategory.WorkLoad,
                this.testParameters.WorkloadActionWeight * this.testParameters.WorkloadParameters.WorkloadScripts.Count);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="System.Fabric.Chaos.RandomActionGenerator.SystemFaultActionGenerator"/> class.
        /// </summary>
        /// <param name="testParameters"> Parameters for this random session.</param>
        /// <param name="random"> Random number generator </param>
        public SystemFaultActionGenerator(SystemFaultActionGeneratorParameters testParameters, Random random)
            : base(random)
        {
            this.testParameters             = testParameters;
            this.systemFaultCategoryChooser = new WeightedDice <SystemFaultCategory>(this.Random);
            this.systemFaultCategoryChooser.AddNewFace(SystemFaultCategory.FmRebuild, testParameters.FmRebuildFaultWeight);

            this.TraceType = "Chaos.SystemFaultActionGenerator";
        }
Example #3
0
        public NodeFaultActionGenerator(NodeFaultActionGeneratorParameters testParameters, Random random)
            : base(random)
        {
            this.testParameters           = testParameters;
            this.nodeFaultCategoryChooser = new WeightedDice <NodeFaultCategory>(this.Random);
            this.nodeFaultCategoryChooser.AddNewFace(NodeFaultCategory.RestartFault, testParameters.RestartNodeFaultWeight);
            this.nodeFaultCategoryChooser.AddNewFace(NodeFaultCategory.StartStopFault, testParameters.StartStopNodeFaultWeight);

            this.TraceType = "Chaos.NodeFaultActionGenerator";
        }
Example #4
0
        private void UpdateDice(WorkloadList workloadInfo)
        {
            this.workloadDice = new WeightedDice <string>(this.Random);

            if (workloadInfo.Workloads != null)
            {
                foreach (string workload in workloadInfo.Workloads)
                {
                    this.workloadDice.AddNewFace(workload, this.workloadScriptDefaultWeight);
                }
            }
        }
        public ServiceFaultActionGenerator(ServiceFaultActionGeneratorParameters testParameters, Random random)
            : base(random)
        {
            this.testParameters = testParameters;

            this.serviceFaultCategoryChooser = new WeightedDice <ServiceFaultCategory>(this.Random);
            this.serviceFaultCategoryChooser.AddNewFace(ServiceFaultCategory.RestartReplica, testParameters.RestartReplicaFaultWeight);
            this.serviceFaultCategoryChooser.AddNewFace(ServiceFaultCategory.RemoveReplica, testParameters.RemoveReplicaFaultWeight);
            this.serviceFaultCategoryChooser.AddNewFace(ServiceFaultCategory.RestartCodePackage, testParameters.RestartCodePackageFaultWeight);
            this.serviceFaultCategoryChooser.AddNewFace(ServiceFaultCategory.MovePrimary, testParameters.MovePrimaryFaultWeight);
            this.serviceFaultCategoryChooser.AddNewFace(ServiceFaultCategory.MoveSecondary, testParameters.MoveSecondaryFaultWeight);

            this.TraceType = "Chaos.ServiceFaultActionGenerator";
        }