99using System . Threading . Tasks ;
1010using System . Threading . Tasks . Dataflow ;
1111using Microsoft . AspNetCore . Hosting ;
12+ using Microsoft . Azure . WebJobs . Host ;
1213using Microsoft . Azure . WebJobs . Host . Executors . Internal ;
1314using Microsoft . Azure . WebJobs . Script . Config ;
1415using Microsoft . Azure . WebJobs . Script . Description ;
@@ -559,25 +560,21 @@ public async Task FunctionDispatcher_RestartOfTimedOutChannels_WebHostFailsCurre
559560
560561 SetUpMocksForTimeoutTests ( mockWebHostChannelManager , mockJobHostChannelManager , mockChannel , invocationId , true ) ;
561562
562- // Setup for initialization of a new channel
563563 var workerConfig = new RpcWorkerConfig
564564 {
565565 Description = new RpcWorkerDescription { Language = "test" } ,
566566 CountOptions = new WorkerProcessCountOptions { ProcessCount = 1 }
567567 } ;
568568
569- // Create the dispatcher with our mocks
570569 var dispatcher = GetTestFunctionDispatcher ( mockwebHostLanguageWorkerChannelManager : mockWebHostChannelManager , mockJobHostLanguageWorkerChannelManager : mockJobHostChannelManager ) ;
571570
572- // Act
573- var result = await dispatcher . RestartWorkerWithInvocationIdAsync ( invocationId ) ;
571+ var result = await dispatcher . RestartWorkerWithInvocationIdAsync ( invocationId , new FunctionTimeoutException ( ) ) ;
574572
575- // Assert
576573 Assert . True ( result ) ;
577574 mockWebHostChannelManager . Verify ( m => m . ShutdownChannelIfExistsAsync (
578575 It . IsAny < string > ( ) ,
579576 It . Is < string > ( id => id == "testChannelId" ) ,
580- It . Is < Exception > ( ex => ex is TimeoutException && ex . Message == $ "Executing invocation ` { invocationId } ` timed out" ) ) ,
577+ It . Is < Exception > ( ex => ex is FunctionTimeoutException ) ) ,
581578 Times . Once ) ;
582579 }
583580
@@ -591,24 +588,20 @@ public async Task FunctionDispatcher_RestartOfTimedOutChannels_JobHostFailsCurre
591588
592589 SetUpMocksForTimeoutTests ( mockWebHostChannelManager , mockJobHostChannelManager , mockChannel , invocationId , false ) ;
593590
594- // Setup for initialization of a new channel
595591 var workerConfig = new RpcWorkerConfig
596592 {
597593 Description = new RpcWorkerDescription { Language = "test" } ,
598594 CountOptions = new WorkerProcessCountOptions { ProcessCount = 1 }
599595 } ;
600596
601- // Create the dispatcher with our mocks
602597 var dispatcher = GetTestFunctionDispatcher ( mockwebHostLanguageWorkerChannelManager : mockWebHostChannelManager , mockJobHostLanguageWorkerChannelManager : mockJobHostChannelManager ) ;
603598
604- // Act
605- var result = await dispatcher . RestartWorkerWithInvocationIdAsync ( invocationId ) ;
599+ var result = await dispatcher . RestartWorkerWithInvocationIdAsync ( invocationId , new FunctionTimeoutException ( ) ) ;
606600
607- // Assert
608601 Assert . True ( result ) ;
609602 mockJobHostChannelManager . Verify ( m => m . ShutdownChannelIfExistsAsync (
610603 It . Is < string > ( id => id == "testChannelId" ) ,
611- It . Is < Exception > ( ex => ex is TimeoutException && ex . Message == $ "Executing invocation ` { invocationId } ` timed out" ) ) ,
604+ It . Is < Exception > ( ex => ex is FunctionTimeoutException ) ) ,
612605 Times . Once ) ;
613606 }
614607
@@ -956,13 +949,13 @@ private void SetUpMocksForTimeoutTests(Mock<IWebHostRpcWorkerChannelManager> moc
956949 mockWebHostChannelManager . Setup ( m => m . ShutdownChannelIfExistsAsync (
957950 It . IsAny < string > ( ) ,
958951 It . Is < string > ( id => id == "testChannelId" ) ,
959- It . Is < Exception > ( ex => ex is TimeoutException && ex . Message == $ "Executing invocation ` { invocationId } ` timed out" ) ) )
952+ It . Is < Exception > ( ex => ex is FunctionTimeoutException ) ) )
960953 . ReturnsAsync ( webHostShutdownSucceeds ) ;
961954
962955 // Set up JobHost ShutdownChannelIfExistsAsync to be called with the right exception type
963956 mockJobHostChannelManager . Setup ( m => m . ShutdownChannelIfExistsAsync (
964957 It . Is < string > ( id => id == "testChannelId" ) ,
965- It . Is < Exception > ( ex => ex is TimeoutException && ex . Message == $ "Executing invocation ` { invocationId } ` timed out" ) ) )
958+ It . Is < Exception > ( ex => ex is FunctionTimeoutException ) ) )
966959 . ReturnsAsync ( ! webHostShutdownSucceeds ) ;
967960 }
968961 }
0 commit comments