Fix integration test failures for multi-tenancy #8447
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We saw several integ test failures when merging in the change for multi-tenancy.
Failure #1 Resource Conflict
In remote invoke integ test, we saw failure like this.
tests/integration/remote/invoke/test_remote_invoke.py::TestSingleLambdaInvoke::test_invoke_asynchronous_using_boto_parameter@sam_remote_invoke_single_lambda_resource - AssertionError: 0 != 1This is due to we added a MultiTenantFunction in the existing template which has a HelloWorldFunction, and when doing remote invoke, we use command like this
sam remote invoke --stack-name TestSingleLambdaInvoke-abc123, sam can't decide which function to invoke, so it failed. The solution is to create a separate template for multi-tenant test.Failure #2 Line number mismatch
in test_integrations_cli.py, we saw error like this
Error: tests/integration/local/invoke/test_integrations_cli.py::TestInvokeFunctionWithError::test_function_exception - AssertionError: '\xa0\xa0File "/var/task/main.py", line 51, in raise_exception' not found in '2025-11-20 00:45:25 Attaching import module proxy for analyzing dynamic imports\nInvoking main.raise_exception (python3.11)\nLocal image is up-to-date\nUsing local image: public.ecr.aws/lambda/python:3.11-rapid-x86_64.\n\nMounting /home/runner/work/aws-sam-cli/aws-sam-cli/tests/integration/testdata/invoke as /var/task:ro,delegated, the reason is multi-tenancy change added code to the tests/integration/testdata/invoke/main.py file, which shifted the line numbers.Failure #3
In test_start_api.py, we saw error like
tests/integration/local/start_api/test_start_api.py::TestStartApiWithStage::test_default_stage_name - AssertionError: None != 'Prod', this is due to we added a new MultiTenantFunction with its own Type: Api in the existing template which has global Api configuration, this conflict causes the failure, the fix is to create a separate template for multi-tenant tests.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.