Skip to content
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

Merged
merged 9 commits into from Dec 13, 2023

Conversation

sannya-singal
Copy link
Contributor

@sannya-singal sannya-singal commented Dec 11, 2023

Motivation

When using values other than 000000000000 for account ID or us-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 throws IndexError or AssertionError since the setup wasn't getting deployed in the correct account.

Changes

This PR:

  • passes AWS_ACCESS_KEY_ID as an environment variable to serverless-localstack.
  • deletes(later undos), the AWS_PROFILE env variable.
  • replaces queue name with queue arn while fetching queue url in method sqs_queue_url_for_arn.
  • passes logs_client in get_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

@sannya-singal sannya-singal added the semver: patch Non-breaking changes which can be included in patch releases label Dec 11, 2023
@sannya-singal sannya-singal self-assigned this Dec 11, 2023
Copy link

github-actions bot commented Dec 11, 2023

LocalStack Community integration with Pro

       2 files  ±0         2 suites  ±0   1h 10m 27s ⏱️ -58s
2 401 tests +1  2 173 ✔️ +1  228 💤 ±0  0 ±0 
2 402 runs  +1  2 173 ✔️ +1  229 💤 ±0  0 ±0 

Results for commit 90f4a42. ± Comparison against base commit d68c9de.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Dec 11, 2023

S3 Image Test Results (AMD64 / ARM64)

    2 files      2 suites   3m 28s ⏱️
377 tests 326 ✔️   51 💤 0
754 runs  652 ✔️ 102 💤 0

Results for commit 9ac9e10.

♻️ This comment has been updated with latest results.

@coveralls
Copy link

coveralls commented Dec 12, 2023

Coverage Status

coverage: 84.02% (-0.007%) from 84.027%
when pulling 90f4a42 on serverless_multi_acc
into d68c9de on master.

@sannya-singal sannya-singal marked this pull request as ready for review December 12, 2023 09:45
@sannya-singal sannya-singal marked this pull request as draft December 12, 2023 10:23
@sannya-singal sannya-singal removed the request for review from viren-nadkarni December 12, 2023 10:23
@sannya-singal sannya-singal marked this pull request as ready for review December 12, 2023 10:32
Copy link
Member

@viren-nadkarni viren-nadkarni left a 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

run(
["npm", "run", "deploy", "--", f"--region={TEST_AWS_REGION_NAME}"],
cwd=base_dir,
env_vars={"AWS_ACCESS_KEY_ID": TEST_AWS_ACCOUNT_ID},
Copy link
Member

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?

@sannya-singal sannya-singal merged commit 236b372 into master Dec 13, 2023
26 checks passed
@sannya-singal sannya-singal deleted the serverless_multi_acc branch December 13, 2023 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants