@@ -665,6 +665,68 @@ def test_function_features(self, lambda_client):
665
665
# Check Lambda function doesn't exist
666
666
assert not lambda_validator .function_exists (resource_name )
667
667
668
+ def test_function_runtime (self , lambda_client ):
669
+ resource_name = random_suffix_name ("function" , 24 )
670
+
671
+ resources = get_bootstrap_resources ()
672
+ logging .debug (resources )
673
+
674
+ replacements = REPLACEMENT_VALUES .copy ()
675
+ replacements ["FUNCTION_NAME" ] = resource_name
676
+ replacements ["BUCKET_NAME" ] = resources .FunctionsBucket .name
677
+ replacements ["LAMBDA_ROLE" ] = resources .BasicRole .arn
678
+ replacements ["LAMBDA_FILE_NAME" ] = LAMBDA_FUNCTION_FILE_ZIP
679
+ replacements ["RESERVED_CONCURRENT_EXECUTIONS" ] = "0"
680
+ replacements ["CODE_SIGNING_CONFIG_ARN" ] = ""
681
+ replacements ["AWS_REGION" ] = get_region ()
682
+
683
+ # Load Lambda CR
684
+ resource_data = load_lambda_resource (
685
+ "function" ,
686
+ additional_replacements = replacements ,
687
+ )
688
+ logging .debug (resource_data )
689
+
690
+ # Create k8s resource
691
+ ref = k8s .CustomResourceReference (
692
+ CRD_GROUP , CRD_VERSION , RESOURCE_PLURAL ,
693
+ resource_name , namespace = "default" ,
694
+ )
695
+ k8s .create_custom_resource (ref , resource_data )
696
+ cr = k8s .wait_resource_consumed_by_controller (ref )
697
+
698
+ assert cr is not None
699
+ assert k8s .get_resource_exists (ref )
700
+
701
+ time .sleep (CREATE_WAIT_AFTER_SECONDS )
702
+
703
+ cr = k8s .wait_resource_consumed_by_controller (ref )
704
+
705
+ lambda_validator = LambdaValidator (lambda_client )
706
+
707
+ # Check Lambda function exists
708
+ assert lambda_validator .function_exists (resource_name )
709
+
710
+ # Update cr
711
+ cr ["spec" ]["runtime" ] = "java21"
712
+
713
+ #Patch k8s resource
714
+ k8s .patch_custom_resource (ref , cr )
715
+ time .sleep (UPDATE_WAIT_AFTER_SECONDS )
716
+
717
+ #Check function_snapstart update fields
718
+ function = lambda_validator .get_function (resource_name )
719
+ assert function ["Configuration" ]["Runtime" ] == "java21"
720
+
721
+ # Delete k8s resource
722
+ _ , deleted = k8s .delete_custom_resource (ref )
723
+ assert deleted is True
724
+
725
+ time .sleep (DELETE_WAIT_AFTER_SECONDS )
726
+
727
+ # Check Lambda function doesn't exist
728
+ assert not lambda_validator .function_exists (resource_name )
729
+
668
730
def test_function_layers (self , lambda_client ):
669
731
resource_name = random_suffix_name ("functionlayers" , 24 )
670
732
0 commit comments