|
7 | 7 | using System.Collections.ObjectModel; |
8 | 8 | using System.IO; |
9 | 9 | using System.Linq; |
| 10 | +using System.Threading; |
10 | 11 | using System.Threading.Tasks; |
11 | 12 | using Microsoft.Azure.WebJobs.Script.Description; |
12 | 13 | using Microsoft.Azure.WebJobs.Script.Workers.Http; |
@@ -223,6 +224,28 @@ public void FunctionMetadataManager_LoadFunctionMetadata_Throws_WhenFunctionProv |
223 | 224 | Assert.DoesNotContain(traces, t => t.FormattedMessage.Contains("2 functions found (Custom)")); |
224 | 225 | } |
225 | 226 |
|
| 227 | + [Fact] |
| 228 | + public void FunctionMetadataManager_IsLogicApp_TimeoutIsInfinite() |
| 229 | + { |
| 230 | + using (new TestScopedEnvironmentVariable(EnvironmentSettingNames.AppKind, ScriptConstants.WorkFlowAppKind)) |
| 231 | + { |
| 232 | + var functionMetadataCollection = new Collection<FunctionMetadata>(); |
| 233 | + var mockFunctionErrors = new Dictionary<string, ImmutableArray<string>>(); |
| 234 | + var mockFunctionMetadataProvider = new Mock<IFunctionMetadataProvider>(); |
| 235 | + var mockFunctionProvider = new Mock<IFunctionProvider>(); |
| 236 | + var workerConfigs = TestHelpers.GetTestWorkerConfigs(); |
| 237 | + var testLoggerProvider = new TestLoggerProvider(); |
| 238 | + var loggerFactory = new LoggerFactory(); |
| 239 | + loggerFactory.AddProvider(testLoggerProvider); |
| 240 | + |
| 241 | + FunctionMetadataManager testFunctionMetadataManager = TestFunctionMetadataManager.GetFunctionMetadataManager(new OptionsWrapper<ScriptJobHostOptions>(_scriptJobHostOptions), |
| 242 | + mockFunctionMetadataProvider.Object, new List<IFunctionProvider>() { mockFunctionProvider.Object }, new OptionsWrapper<HttpWorkerOptions>(_defaultHttpWorkerOptions), loggerFactory, |
| 243 | + new TestOptionsMonitor<LanguageWorkerOptions>(TestHelpers.GetTestLanguageWorkerOptions())); |
| 244 | + |
| 245 | + Assert.Equal(Timeout.InfiniteTimeSpan, testFunctionMetadataManager.MetadataProviderTimeout); |
| 246 | + } |
| 247 | + } |
| 248 | + |
226 | 249 | [Fact] |
227 | 250 | public void FunctionMetadataManager_LoadFunctionMetadata_Throws_WhenFunctionProvidersTimesOut() |
228 | 251 | { |
@@ -256,7 +279,7 @@ public void FunctionMetadataManager_LoadFunctionMetadata_Throws_WhenFunctionProv |
256 | 279 | mockFunctionMetadataProvider.Object, new List<IFunctionProvider>() { goodFunctionMetadataProvider.Object, badFunctionMetadataProvider.Object }, new OptionsWrapper<HttpWorkerOptions>(_defaultHttpWorkerOptions), loggerFactory, new TestOptionsMonitor<LanguageWorkerOptions>(TestHelpers.GetTestLanguageWorkerOptions())); |
257 | 280 |
|
258 | 281 | // Set the timeout to 1 second for the test. |
259 | | - testFunctionMetadataManager.MetadataProviderTimeoutInSeconds = 1; |
| 282 | + testFunctionMetadataManager.MetadataProviderTimeout = TimeSpan.FromSeconds(1); |
260 | 283 |
|
261 | 284 | var exception = Assert.Throws<TimeoutException>(() => testFunctionMetadataManager.LoadFunctionMetadata()); |
262 | 285 | Assert.Contains($"Timeout occurred while retrieving metadata from provider '{badFunctionMetadataProvider.Object.GetType().FullName}'. The operation exceeded the configured timeout of 1 seconds.", exception.Message); |
|
0 commit comments