@@ -362,8 +362,8 @@ public void ValidateWorkerDescription_DoesNotModifyDefaultWorkerExecutablePath_W
362
362
[ InlineData ( "%FUNCTIONS_WORKER_RUNTIME_VERSION%/{os}" , "3.7/LINUX" ) ]
363
363
public void LanguageWorker_FormatWorkerPath_EnvironmentVersionSet ( string defaultWorkerPath , string expectedPath )
364
364
{
365
+ _testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeSettingName , "python" ) ;
365
366
_testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeVersionSettingName , "3.7" ) ;
366
-
367
367
RpcWorkerDescription workerDescription = new RpcWorkerDescription ( )
368
368
{
369
369
Arguments = new List < string > ( ) ,
@@ -551,6 +551,7 @@ public void LanguageWorker_FormatWorkerPath_UnsupportedDefaultRuntimeVersion()
551
551
public void LanguageWorker_FormatWorkerPath_UnsupportedEnvironmentRuntimeVersion ( )
552
552
{
553
553
_testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeVersionSettingName , "3.4" ) ;
554
+ _testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeSettingName , "python" ) ;
554
555
555
556
RpcWorkerDescription workerDescription = new RpcWorkerDescription ( )
556
557
{
@@ -576,6 +577,28 @@ public void LanguageWorker_FormatWorkerPath_UnsupportedEnvironmentRuntimeVersion
576
577
Assert . Equal ( ex . Message , $ "Version 3.4 is not supported for language { workerDescription . Language } ") ;
577
578
}
578
579
580
+ [ Fact ]
581
+ public void LanguageWorker_FormatWorkerPath_DefualtRuntimeVersion_WorkerRuntimeMismatch ( )
582
+ {
583
+ _testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeVersionSettingName , "13" ) ;
584
+ _testEnvironment . SetEnvironmentVariable ( RpcWorkerConstants . FunctionWorkerRuntimeSettingName , "node" ) ;
585
+
586
+ RpcWorkerDescription workerDescription = new RpcWorkerDescription ( )
587
+ {
588
+ Arguments = new List < string > ( ) ,
589
+ DefaultExecutablePath = "python" ,
590
+ SupportedRuntimeVersions = new List < string > ( ) { "3.6" , "3.7" } ,
591
+ DefaultWorkerPath = $ "{ RpcWorkerConstants . RuntimeVersionPlaceholder } /worker.py",
592
+ WorkerDirectory = string . Empty ,
593
+ Extensions = new List < string > ( ) { ".py" } ,
594
+ Language = "python" ,
595
+ DefaultRuntimeVersion = "3.7" // Ignore this if environment is set
596
+ } ;
597
+ var testLogger = new TestLogger ( "test" ) ;
598
+ workerDescription . FormatWorkerPathIfNeeded ( _testSysRuntimeInfo , _testEnvironment , testLogger ) ;
599
+ Assert . Equal ( "3.7" , workerDescription . DefaultRuntimeVersion ) ;
600
+ }
601
+
579
602
private IEnumerable < RpcWorkerConfig > TestReadWorkerProviderFromConfig ( IEnumerable < TestRpcWorkerConfig > configs , ILogger testLogger , TestMetricsLogger testMetricsLogger , string language = null , Dictionary < string , string > keyValuePairs = null , bool appSvcEnv = false )
580
603
{
581
604
Mock < IEnvironment > mockEnvironment = new Mock < IEnvironment > ( ) ;
0 commit comments