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
fix: serverless failing multi-account/region tests #9840
Conversation
a7b96f6
to
c5f55e4
Compare
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.
A clean fix, LGTM! Good to merge once the changes in localstack.constants
are reverted
tests/aws/test_serverless.py
Outdated
run( | ||
["npm", "run", "deploy", "--", f"--region={TEST_AWS_REGION_NAME}"], | ||
cwd=base_dir, | ||
env_vars={"AWS_ACCESS_KEY_ID": TEST_AWS_ACCOUNT_ID}, |
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.
Non-blocking: Is it possible to use the TEST_AWS_ACCESS_KEY_ID
var here?
Motivation
When using values other than
000000000000
for account ID orus-east-1
for region,serverless
tests should still create the consequent resources in these accounts and region. When we try to deploy the serverless setup using non-default region value in tests it throwsIndexError
orAssertionError
since the setup wasn't getting deployed in the correct account.Changes
This PR:
AWS_ACCESS_KEY_ID
as an environment variable toserverless-localstack
.AWS_PROFILE
env variable.sqs_queue_url_for_arn
.logs_client
inget_lambda_log_events
.Testing
The tests were failing previously when executed with a non-default account ID, set through environment variables (
TEST_AWS_ACCOUNT_ID=111111111111
,TEST_AWS_ACCESS_KEY_ID=111111111111
,TEST_AWS_REGION=us-west-1
). This PR fixes:tests.aws.test_serverless.TestServerless.test_event_rules_deployed
tests.aws.test_serverless.TestServerless.test_dynamodb_stream_handler_deployed
tests.aws.test_serverless.TestServerless.test_kinesis_stream_handler_deployed
tests.aws.test_serverless.TestServerless.test_queue_handler_deployed
tests.aws.test_serverless.TestServerless.test_lambda_with_configs_deployed
tests.aws.test_serverless.TestServerless.test_apigateway_deployed