public void TestInitialize() { configStore = new MockConfigStore(); var configReader = new ConfigReader(new ConfigSection(new TraceType(Constants.TraceTypeName), configStore, "IS")); context = new AskModeContext(configReader, "fabric:/IS"); }
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); }
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); }
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(); }; }
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); }