コード例 #1
0
        public void TestInitialize()
        {
            configStore = new MockConfigStore();

            var configReader = new ConfigReader(new ConfigSection(new TraceType(Constants.TraceTypeName), configStore, "IS"));

            context = new AskModeContext(configReader, "fabric:/IS");
        }
コード例 #2
0
        public void TestInitialize()
        {
            this.configStore = new MockConfigStore();

            var env = new CoordinatorEnvironment(
                "fabric:/System/InfrastructureService",
                new ConfigSection(TraceType, this.configStore, ConfigSectionName),
                string.Empty,
                new MockInfrastructureAgentWrapper());

            this.translator = new ImpactTranslator(env);
        }
コード例 #3
0
        public void CoordinatorDutyCycleWarningThresholdTest()
        {
            var store   = new MockConfigStore();
            var section = new ConfigSection(new TraceType("X"), store, "Section");

            var reader = new ConfigReader(section);

            Assert.AreEqual(0.5, reader.CoordinatorDutyCycleWarningThreshold);

            store.UpdateKey("Section", "Autopilot.CoordinatorDutyCycleWarningThreshold", "0.75");
            Assert.AreEqual(0.75, reader.CoordinatorDutyCycleWarningThreshold);

            store.UpdateKey("Section", "Autopilot.CoordinatorDutyCycleWarningThreshold", "1.75");
            Assert.AreEqual(1.0, reader.CoordinatorDutyCycleWarningThreshold);

            store.UpdateKey("Section", "Autopilot.CoordinatorDutyCycleWarningThreshold", "-2");
            Assert.AreEqual(0.0, reader.CoordinatorDutyCycleWarningThreshold);
        }
コード例 #4
0
        public void Initialize()
        {
            configStore = new MockConfigStore();
            configStore.AddKeyValue("InfrastructureService", "Azure.ProcessRemovedNodesRetryIntervalInSeconds", "1");

            env = new CoordinatorEnvironment(
                "fabric:/IS",
                new ConfigSection(Constants.TraceType, configStore, "InfrastructureService"),
                string.Empty,
                new MockInfrastructureAgentWrapper());

            rm = new DelegatedRepairManager <MockRepairTask>();
            rm.UpdateRepairExecutionStateAsyncHandler = t => Task.FromResult(0L);
            rm.RemoveNodeStateAsyncHandler            = (n, timeout, token) =>
            {
                throw new InvalidOperationException();
            };
        }
コード例 #5
0
        public IInfrastructureCoordinator Create()
        {
            string configSectionName = typeof(MockInfrastructureCoordinatorFactory).Name + "ConfigSection";

            const string ConfigJobPollingIntervalInSecondsKeyName = Parallel.Constants.ConfigKeys.JobPollingIntervalInSeconds;

            var configStore = new MockConfigStore();

            // loop faster in the ProcessManagementNotification loop of WindowsAzureInfrastructureCoordinator
            configStore.AddKeyValue(configSectionName, ConfigJobPollingIntervalInSecondsKeyName, "1");

            foreach (var pair in configSettings)
            {
                configStore.AddKeyValue(configSectionName, pair.Key, pair.Value);
            }

            var partitionId = Guid.NewGuid();
            var jobBlockingPolicyManager = new MockJobBlockingPolicyManager();
            var activityLogger           = new ActivityLoggerFactory().Create(Constants.TraceType);
            var configSection            = new ConfigSection(Constants.TraceType, configStore, configSectionName);
            var allowActionMap           = new AllowActionMap();
            var env = new CoordinatorEnvironment("fabric:/System/InfrastructureService/Mock", configSection, "mytenant", new MockInfrastructureAgentWrapper());
            var coordinatorCommandProcessor = new CoordinatorCommandProcessor(env, policyAgentClient, jobBlockingPolicyManager, allowActionMap);

            var coordinator = new AzureParallelInfrastructureCoordinator(
                env,
                "mytenant",
                policyAgentClient,
                repairManager,
                new MockHealthClient(),
                coordinatorCommandProcessor,
                jobBlockingPolicyManager,
                new DefaultActionPolicyFactory(env, jobBlockingPolicyManager, allowActionMap),
                activityLogger,
                partitionId,
                0);

            return(coordinator);
        }