-
Notifications
You must be signed in to change notification settings - Fork 2.5k
add integration test for LMI functions #3863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
integration/combination/test_function_with_capacity_provider.py
Outdated
Show resolved
Hide resolved
integration/resources/templates/combination/function_lmi_custom.yaml
Outdated
Show resolved
Hide resolved
integration/resources/templates/combination/function_lmi_custom.yaml
Outdated
Show resolved
Hide resolved
integration/resources/templates/combination/function_lmi_default.yaml
Outdated
Show resolved
Hide resolved
integration/combination/test_function_with_capacity_provider.py
Outdated
Show resolved
Hide resolved
integration/combination/test_function_with_capacity_provider.py
Outdated
Show resolved
Hide resolved
|
Run integration tests: |
| simple_capacity_provider = next( | ||
| r for r in capacity_provider_resources if r["LogicalResourceId"] == "SimpleCapacityProvider" | ||
| ) | ||
| advanced_capacity_provider = next( | ||
| r for r in capacity_provider_resources if r["LogicalResourceId"] == "AdvancedCapacityProvider" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the same self.get_physical_id_by_logical_id in these two, right? (changing inside get_lambda_capacity_provider_config to just use the parameter instead of having to take the physical id from it)
| # Phase 5: Validate SimpleCapacityProvider configuration | ||
| simple_cp_config = self.get_lambda_capacity_provider_config(simple_capacity_provider) | ||
| self.assertIsNotNone(simple_cp_config, "SimpleCapacityProvider should have configuration") | ||
| self.assertEqual(simple_cp_config["State"], "Active", "SimpleCapacityProvider should be in Active state") | ||
|
|
||
| # Verify the function uses SimpleCapacityProvider | ||
| simple_cp_arn = simple_cp_config.get("CapacityProviderArn") | ||
| self.assertEqual( | ||
| function_capacity_provider_arn, simple_cp_arn, "Function should reference SimpleCapacityProvider ARN" | ||
| ) | ||
|
|
||
| # Verify SimpleCapacityProvider VPC configuration | ||
| simple_vpc_config = simple_cp_config.get("VpcConfig") | ||
| self.assertIsNotNone(simple_vpc_config, "SimpleCapacityProvider should have VPC configuration") | ||
| self.assertIn( | ||
| self.companion_stack_outputs["LMISubnetId"], | ||
| simple_vpc_config["SubnetIds"], | ||
| "SimpleCapacityProvider should use the correct subnet", | ||
| ) | ||
| self.assertIn( | ||
| self.companion_stack_outputs["LMISecurityGroupId"], | ||
| simple_vpc_config["SecurityGroupIds"], | ||
| "SimpleCapacityProvider should use the correct security group", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like all these basic checks are being repeated for the advanced capacity provider. Can we take them out to a separate function so can just reuse the same checks in both places instead of duplicating the code? (and it can be used in the previous tests too)
Issue #, if available
Add integration test for deploying application with CapacityProvider and LMI functions
Description of changes
Add test data and test cases for successfully deployment of resources.
Description of how you validated changes
Checklist
Testing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.