public void Returns_Remote_Config_Value_From_File_Scheme() { var options = new HystrixJsonConfigurationSourceOptions { BaseLocation = GetLocalBaseLocation(), LocationPattern = "{0}-{1}.json" }; var commandIdentifier = new HystrixCommandIdentifier("Group", "Command"); var configurationService = new HystrixJsonConfigConfigurationService(commandIdentifier, options); // Act var value = configurationService.GetCommandTimeoutInMilliseconds(); Assert.Equal(25000, value); }
public void Returns_Values_From_Default_Json_If_Specific_Json_Is_Invalid() { using (var apiStub = new ApiStub()) { apiStub.Get( "/Group-Command.json", (req, args) => @"This is { not a valid json """); apiStub.Get( "/Default.json", (req, args) => @"{ ""HystrixCommandEnabled"": true, ""CommandTimeoutInMilliseconds"":50000, ""CircuitBreakerForcedOpen"":false, ""CircuitBreakerForcedClosed"":false, ""CircuitBreakerErrorThresholdPercentage"":50, ""CircuitBreakerSleepWindowInMilliseconds"":5000, ""CircuitBreakerRequestVolumeThreshold"":20, ""MetricsHealthSnapshotIntervalInMilliseconds"":500, ""MetricsRollingStatisticalWindowInMilliseconds"":10000, ""MetricsRollingStatisticalWindowBuckets"":10, ""MetricsRollingPercentileEnabled"":true, ""MetricsRollingPercentileWindowInMilliseconds"":60000, ""MetricsRollingPercentileWindowBuckets"":6, ""MetricsRollingPercentileBucketSize"":100 }"); apiStub.Start(); var options = new HystrixJsonConfigurationSourceOptions { BaseLocation = apiStub.Address, LocationPattern = "{0}-{1}.json" }; var commandIdentifier = new HystrixCommandIdentifier("Group", "Command"); var configurationService = new HystrixJsonConfigConfigurationService(commandIdentifier, options); // Act var value = configurationService.GetCommandTimeoutInMilliseconds(); Assert.Equal(50000, value); } }