@@ -604,6 +604,67 @@ def test_function_architecture(self, lambda_client):
604
604
# Check Lambda function doesn't exist
605
605
assert not lambda_validator .function_exists (resource_name )
606
606
607
+ def test_function_features (self , lambda_client ):
608
+ resource_name = random_suffix_name ("functionfeatures" , 24 )
609
+
610
+ resources = get_bootstrap_resources ()
611
+ logging .debug (resources )
612
+
613
+ replacements = REPLACEMENT_VALUES .copy ()
614
+ replacements ["FUNCTION_NAME" ] = resource_name
615
+ replacements ["BUCKET_NAME" ] = resources .FunctionsBucket .name
616
+ replacements ["LAMBDA_ROLE" ] = resources .EICRole .arn
617
+ replacements ["LAMBDA_FILE_NAME" ] = LAMBDA_FUNCTION_FILE_ZIP
618
+ replacements ["AWS_REGION" ] = get_region ()
619
+ replacements ["DEAD_LETTER_CONFIG_TARGET_ARN" ] = resources .EICQueueOnSuccess .arn
620
+
621
+ # Load Lambda CR
622
+ resource_data = load_lambda_resource (
623
+ "function_features" ,
624
+ additional_replacements = replacements ,
625
+ )
626
+ logging .debug (resource_data )
627
+
628
+ # Create k8s resource
629
+ ref = k8s .CustomResourceReference (
630
+ CRD_GROUP , CRD_VERSION , RESOURCE_PLURAL ,
631
+ resource_name , namespace = "default" ,
632
+ )
633
+ k8s .create_custom_resource (ref , resource_data )
634
+ cr = k8s .wait_resource_consumed_by_controller (ref )
635
+
636
+ assert cr is not None
637
+ assert k8s .get_resource_exists (ref )
638
+
639
+ time .sleep (CREATE_WAIT_AFTER_SECONDS )
640
+
641
+ cr = k8s .wait_resource_consumed_by_controller (ref )
642
+
643
+ lambda_validator = LambdaValidator (lambda_client )
644
+
645
+ # Check Lambda function exists
646
+ assert lambda_validator .function_exists (resource_name )
647
+
648
+ # Update cr
649
+ cr ["spec" ]["deadLetterConfig" ]["targetArn" ] = resources .EICQueueOnFailure .arn
650
+
651
+ #Patch k8s resource
652
+ k8s .patch_custom_resource (ref , cr )
653
+ time .sleep (UPDATE_WAIT_AFTER_SECONDS )
654
+
655
+ #Check function_snapstart update fields
656
+ function = lambda_validator .get_function (resource_name )
657
+ assert function ["Configuration" ]["DeadLetterConfig" ]["TargetARN" ] == resources .EICQueueOnFailure .arn
658
+
659
+ # Delete k8s resource
660
+ _ , deleted = k8s .delete_custom_resource (ref )
661
+ assert deleted is True
662
+
663
+ time .sleep (DELETE_WAIT_AFTER_SECONDS )
664
+
665
+ # Check Lambda function doesn't exist
666
+ assert not lambda_validator .function_exists (resource_name )
667
+
607
668
def test_function_event_invoke_config (self , lambda_client ):
608
669
resource_name = random_suffix_name ("lambda-function" , 24 )
609
670
0 commit comments