@@ -67,6 +67,7 @@ public async Task RpcInitializationService_Initializes_RpcServerAndChannels_Wind
67
67
var mockEnvironment = new Mock < IEnvironment > ( ) ;
68
68
mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( EnvironmentSettingNames . AzureWebsitePlaceholderMode ) ) . Returns ( "1" ) ;
69
69
mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( LanguageWorkerConstants . FunctionWorkerRuntimeSettingName ) ) . Returns ( string . Empty ) ;
70
+ mockEnvironment . Setup ( p => p . GetEnvironmentVariable ( EnvironmentSettingNames . AzureWebsiteName ) ) . Returns ( "functionsPlaceholderTemplateSite" ) ;
70
71
71
72
_rpcInitializationService = new RpcInitializationService ( _optionsMonitor , mockEnvironment . Object , testRpcServer , _mockLanguageWorkerChannelManager . Object , _logger ) ;
72
73
await _rpcInitializationService . StartAsync ( CancellationToken . None ) ;
@@ -287,5 +288,21 @@ public async Task RpcInitializationService_TriggerShutdown_KillGetsCalledWhenShu
287
288
testRpcServer . Verify ( a => a . ShutdownAsync ( ) , Times . Once ) ;
288
289
testRpcServer . Verify ( a => a . KillAsync ( ) , Times . Once ) ;
289
290
}
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
+ }
290
307
}
291
308
}
0 commit comments