@@ -67,6 +67,7 @@ public async Task RpcInitializationService_Initializes_RpcServerAndChannels_Wind
6767 var mockEnvironment = new Mock < IEnvironment > ( ) ;
6868 mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( EnvironmentSettingNames . AzureWebsitePlaceholderMode ) ) . Returns ( "1" ) ;
6969 mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( LanguageWorkerConstants . FunctionWorkerRuntimeSettingName ) ) . Returns ( string . Empty ) ;
70+ mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( EnvironmentSettingNames . AzureWebsiteName ) ) . Returns ( "functionsPlaceholderTemplateSite" ) ;
7071
7172 _rpcInitializationService = new RpcInitializationService ( _optionsMonitor , mockEnvironment . Object , testRpcServer , _mockLanguageWorkerChannelManager . Object , _logger ) ;
7273 await _rpcInitializationService . StartAsync ( CancellationToken . None ) ;
@@ -287,5 +288,21 @@ public async Task RpcInitializationService_TriggerShutdown_KillGetsCalledWhenShu
287288 testRpcServer . Verify ( a => a . ShutdownAsync ( ) , Times . Once ) ;
288289 testRpcServer . Verify ( a => a . KillAsync ( ) , Times . Once ) ;
289290 }
291+
292+ [ Theory ]
293+ [ InlineData ( "1" , "functionsPlaceholderTemplateSite" , "1234" , true ) ]
294+ [ InlineData ( "0" , "functionsPlaceholderTemplateSite" , "1234" , false ) ]
295+ [ InlineData ( "1" , "functionsPlaceholderTemplateSitejava" , "1234" , false ) ]
296+ [ InlineData ( "1" , "functionsPlaceholderTemplateSite" , "" , true ) ]
297+ public void ShouldStartInPlaceholderMode_Returns_ExpectedValue ( string placeholderMode , string siteName , string siteInstanaceId , bool expectedResult )
298+ {
299+ Mock < IRpcServer > testRpcServer = new Mock < IRpcServer > ( ) ;
300+ var mockEnvironment = new Mock < IEnvironment > ( ) ;
301+ mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( EnvironmentSettingNames . AzureWebsitePlaceholderMode ) ) . Returns ( placeholderMode ) ;
302+ mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( EnvironmentSettingNames . AzureWebsiteName ) ) . Returns ( siteName ) ;
303+ mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( EnvironmentSettingNames . AzureWebsiteInstanceId ) ) . Returns ( siteInstanaceId ) ;
304+ _rpcInitializationService = new RpcInitializationService ( _optionsMonitor , mockEnvironment . Object , testRpcServer . Object , _mockLanguageWorkerChannelManager . Object , _logger ) ;
305+ Assert . Equal ( _rpcInitializationService . ShouldStartInPlaceholderMode ( ) , expectedResult ) ;
306+ }
290307 }
291308}
0 commit comments