@@ -368,8 +368,8 @@ public void LanguageWorker_FormatWorkerPath_EnvironmentVersionSet(
368
368
string sanitizeRuntimeVersionRegex ,
369
369
string expectedPath )
370
370
{
371
+ _testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeSettingName , "python" ) ;
371
372
_testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeVersionSettingName , environmentRuntimeVersion ) ;
372
-
373
373
RpcWorkerDescription workerDescription = new RpcWorkerDescription ( )
374
374
{
375
375
Arguments = new List < string > ( ) ,
@@ -571,6 +571,7 @@ public void LanguageWorker_FormatWorkerPath_UnsupportedEnvironmentRuntimeVersion
571
571
string expectedExceptionMessage )
572
572
{
573
573
_testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeVersionSettingName , "3.4" ) ;
574
+ _testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeSettingName , "python" ) ;
574
575
575
576
RpcWorkerDescription workerDescription = new RpcWorkerDescription ( )
576
577
{
@@ -597,6 +598,28 @@ public void LanguageWorker_FormatWorkerPath_UnsupportedEnvironmentRuntimeVersion
597
598
Assert . Equal ( ex . Message , expectedExceptionMessage ) ;
598
599
}
599
600
601
+ [ Fact ]
602
+ public void LanguageWorker_FormatWorkerPath_DefualtRuntimeVersion_WorkerRuntimeMismatch ( )
603
+ {
604
+ _testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeVersionSettingName , "13" ) ;
605
+ _testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeSettingName , "node" ) ;
606
+
607
+ RpcWorkerDescription workerDescription = new RpcWorkerDescription ( )
608
+ {
609
+ Arguments = new List < string > ( ) ,
610
+ DefaultExecutablePath = "python" ,
611
+ SupportedRuntimeVersions = new List < string > ( ) { "3.6" , "3.7" } ,
612
+ DefaultWorkerPath = $ "{ RpcWorkerConstants . RuntimeVersionPlaceholder } /worker.py",
613
+ WorkerDirectory = string . Empty ,
614
+ Extensions = new List < string > ( ) { ".py" } ,
615
+ Language = "python" ,
616
+ DefaultRuntimeVersion = "3.7" // Ignore this if environment is set
617
+ } ;
618
+ var testLogger = new TestLogger ( "test" ) ;
619
+ workerDescription . FormatWorkerPathIfNeeded ( _testSysRuntimeInfo , _testEnvironment , testLogger ) ;
620
+ Assert . Equal ( "3.7" , workerDescription . DefaultRuntimeVersion ) ;
621
+ }
622
+
600
623
private IEnumerable < RpcWorkerConfig > TestReadWorkerProviderFromConfig ( IEnumerable < TestRpcWorkerConfig > configs , ILogger testLogger , TestMetricsLogger testMetricsLogger , string language = null , Dictionary < string , string > keyValuePairs = null , bool appSvcEnv = false )
601
624
{
602
625
Mock < IEnvironment > mockEnvironment = new Mock < IEnvironment > ( ) ;
0 commit comments