@@ -29,6 +29,7 @@ namespace Microsoft.Azure.WebJobs.Script.Tests
2929{
3030 public class WebJobsScriptHostServiceTests
3131 {
32+ private readonly OptionsWrapper < FunctionsHostingConfigOptions > _functionsHostingConfigOptions = new ( new FunctionsHostingConfigOptions ( ) ) ;
3233 private WebJobsScriptHostService _hostService ;
3334 private ScriptApplicationHostOptionsMonitor _monitor ;
3435 private TestLoggerProvider _webHostLoggerProvider = new TestLoggerProvider ( ) ;
@@ -107,7 +108,7 @@ public async Task StartAsync_Succeeds()
107108 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
108109 _hostPerformanceManager , _healthMonitorOptions ,
109110 metricsLogger , new Mock < IApplicationLifetime > ( ) . Object ,
110- _mockConfig , mockEventManager . Object ) ;
111+ _mockConfig , mockEventManager . Object , _functionsHostingConfigOptions ) ;
111112
112113 await _hostService . StartAsync ( CancellationToken . None ) ;
113114
@@ -138,7 +139,7 @@ public async Task HostInitialization_OnInitializationException_MaintainsErrorInf
138139 _monitor , hostBuilder . Object , NullLoggerFactory . Instance ,
139140 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
140141 _hostPerformanceManager , _healthMonitorOptions , metricsLogger ,
141- new Mock < IApplicationLifetime > ( ) . Object , _mockConfig , new TestScriptEventManager ( ) ) ;
142+ new Mock < IApplicationLifetime > ( ) . Object , _mockConfig , new TestScriptEventManager ( ) , _functionsHostingConfigOptions ) ;
142143
143144 await _hostService . StartAsync ( CancellationToken . None ) ;
144145 Assert . True ( AreRequiredMetricsGenerated ( metricsLogger ) ) ;
@@ -168,7 +169,7 @@ public async Task HostRestart_Specialization_Succeeds()
168169 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
169170 _hostPerformanceManager , _healthMonitorOptions ,
170171 metricsLogger , new Mock < IApplicationLifetime > ( ) . Object ,
171- _mockConfig , new TestScriptEventManager ( ) ) ;
172+ _mockConfig , new TestScriptEventManager ( ) , _functionsHostingConfigOptions ) ;
172173
173174 await _hostService . StartAsync ( CancellationToken . None ) ;
174175 Assert . True ( AreRequiredMetricsGenerated ( metricsLogger ) ) ;
@@ -223,7 +224,7 @@ public async Task HostRestart_DuringInitializationWithError_Recovers()
223224 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
224225 _hostPerformanceManager , _healthMonitorOptions ,
225226 metricsLogger , new Mock < IApplicationLifetime > ( ) . Object ,
226- _mockConfig , new TestScriptEventManager ( ) ) ;
227+ _mockConfig , new TestScriptEventManager ( ) , _functionsHostingConfigOptions ) ;
227228
228229 TestLoggerProvider hostALogger = hostA . Object . GetTestLoggerProvider ( ) ;
229230 TestLoggerProvider hostBLogger = hostB . Object . GetTestLoggerProvider ( ) ;
@@ -299,7 +300,7 @@ public async Task HostRestart_DuringInitialization_Cancels()
299300 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
300301 _hostPerformanceManager , _healthMonitorOptions ,
301302 metricsLogger , new Mock < IApplicationLifetime > ( ) . Object ,
302- _mockConfig , new TestScriptEventManager ( ) ) ;
303+ _mockConfig , new TestScriptEventManager ( ) , _functionsHostingConfigOptions ) ;
303304
304305 TestLoggerProvider hostALogger = hostA . Object . GetTestLoggerProvider ( ) ;
305306
@@ -368,7 +369,8 @@ public async Task DisposedHost_ServicesNotExposed()
368369 _monitor , hostBuilder . Object , NullLoggerFactory . Instance ,
369370 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
370371 _hostPerformanceManager , _healthMonitorOptions , metricsLogger ,
371- new Mock < IApplicationLifetime > ( ) . Object , _mockConfig , new TestScriptEventManager ( ) ) ;
372+ new Mock < IApplicationLifetime > ( ) . Object , _mockConfig , new TestScriptEventManager ( ) ,
373+ _functionsHostingConfigOptions ) ;
372374
373375 Task startTask = _hostService . StartAsync ( CancellationToken . None ) ;
374376
@@ -419,7 +421,7 @@ public async Task DisposesScriptHost()
419421 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
420422 _hostPerformanceManager , _healthMonitorOptions ,
421423 metricsLogger , new Mock < IApplicationLifetime > ( ) . Object ,
422- _mockConfig , new TestScriptEventManager ( ) ) ;
424+ _mockConfig , new TestScriptEventManager ( ) , _functionsHostingConfigOptions ) ;
423425
424426 var hostLogger = host . Object . GetTestLoggerProvider ( ) ;
425427
@@ -456,7 +458,8 @@ public async Task HostRestart_BeforeStart_WaitsForStartToContinue()
456458 _monitor , hostBuilder . Object , _loggerFactory ,
457459 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
458460 _hostPerformanceManager , _healthMonitorOptions , metricsLogger ,
459- new Mock < IApplicationLifetime > ( ) . Object , _mockConfig , new TestScriptEventManager ( ) ) ;
461+ new Mock < IApplicationLifetime > ( ) . Object , _mockConfig ,
462+ new TestScriptEventManager ( ) , _functionsHostingConfigOptions ) ;
460463
461464 // Simulate a call to specialize coming from the PlaceholderSpecializationMiddleware. This
462465 // can happen before we ever start the service, which could create invalid state.
@@ -511,7 +514,8 @@ public void ShouldEnforceSequentialRestart_WithCorrectConfig(string value, bool
511514 _monitor , hostBuilder . Object , NullLoggerFactory . Instance ,
512515 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
513516 _hostPerformanceManager , _healthMonitorOptions , metricsLogger ,
514- new Mock < IApplicationLifetime > ( ) . Object , config , new TestScriptEventManager ( ) ) ;
517+ new Mock < IApplicationLifetime > ( ) . Object , config , new TestScriptEventManager ( ) ,
518+ _functionsHostingConfigOptions ) ;
515519
516520 Assert . Equal ( expectedResult , _hostService . ShouldEnforceSequentialRestart ( ) ) ;
517521 }
@@ -548,7 +552,8 @@ public async Task DependencyTrackingTelemetryModule_Race()
548552 _monitor , scriptHostBuilder . Object , NullLoggerFactory . Instance ,
549553 _mockScriptWebHostEnvironment . Object , _mockEnvironment . Object ,
550554 _hostPerformanceManager , _healthMonitorOptions , new TestMetricsLogger ( ) ,
551- new Mock < IApplicationLifetime > ( ) . Object , _mockConfig , new TestScriptEventManager ( ) ) )
555+ new Mock < IApplicationLifetime > ( ) . Object , _mockConfig , new TestScriptEventManager ( ) ,
556+ _functionsHostingConfigOptions ) )
552557 {
553558 await _hostService . StartAsync ( CancellationToken . None ) ;
554559
0 commit comments