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

test: Add integration tests to exercise the Lambda subscriptions #71

Merged
merged 7 commits into from
Nov 27, 2023

Conversation

ashovlin
Copy link
Contributor

@ashovlin ashovlin commented Nov 14, 2023

Issue #, if available: DOTNET-6922

Description of changes: Adds integration tests that create actual SQS queues mapped to Lambda functions.

Addressed feedback on #52 at the time it was closed (due to us stopping and then restarting this ticket now). I couldn't re-open since I rebased the branch on dev.

The majority of this is the scaffolding, right now the tests are just testing either a single successful or single failing message against ProcessLambdaEventAsync and ProcessLambdaEventWithBatchResponseAsync. But it's easier to iterate on tests now that the setup is in place, so open to feedback if you think we should add additional test cases.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ashovlin ashovlin changed the title Shovlia/lambda integration tests est: Add integration tests to exercise the Lambda subscriptions Nov 14, 2023
@ashovlin ashovlin changed the title est: Add integration tests to exercise the Lambda subscriptions test: Add integration tests to exercise the Lambda subscriptions Nov 14, 2023
@ashovlin ashovlin marked this pull request as ready for review November 14, 2023 23:17
Copy link
Contributor

@96malhar 96malhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I am fine with the testing approach that we are taking. But I'd like to see 2 additional logical pieces being exercised (should be easy to add since the AWSUtilities and TestUtilities does most of the heavy lifting)

  • Verify that the message source is correctly resolved from AWS_LAMBDA_FUNCTION_NAME environment variable
    • Log the message source to cloudwatch and assert on it.
  • Verify FIFO processing of messages
    • Process 3 or more messages (belonging to the same group) from a FIFO queue and log their ProcessEnd times to CloudWatch. Assert that they were processed in the same order in which they were published.

test/AWS.Messaging.IntegrationTests/LambdaTests.cs Outdated Show resolved Hide resolved
test/AWS.Messaging.Tests.LambdaFunctions/Functions.cs Outdated Show resolved Hide resolved
@ashovlin
Copy link
Contributor Author

Overall I am fine with the testing approach that we are taking. But I'd like to see 2 additional logical pieces being exercised (should be easy to add since the AWSUtilities and TestUtilities does most of the heavy lifting)

* Verify that the message source is correctly resolved from `AWS_LAMBDA_FUNCTION_NAME` environment variable
  
  * Log the message source to cloudwatch and assert on it.

* Verify FIFO processing of messages
  
  * Process 3 or more messages (belonging to the same group)  from a FIFO queue and log their `ProcessEnd` times to CloudWatch. Assert that they were processed in the same order in which they were published.

Added FIFO tests in c416d61.

I started going down the path of testing the message source, but currently we're not actually sending any messages from the Lambda function. I started a "bidirectional" test where we'd message the Lambda and then it'd reply with a forwarded message that we can assert the source on the client. But we'd have to expand the IAM permissions given to the Lambda to allow publishing (with the queueURL), as well as run a poller on the client. Overall it was feeling like more effort and setup code/time than it was worth.

@ashovlin ashovlin force-pushed the shovlia/lambda-integration-tests branch from c416d61 to 70b6881 Compare November 27, 2023 20:22
@ashovlin ashovlin merged commit 22bd734 into dev Nov 27, 2023
5 checks passed
@ashovlin ashovlin deleted the shovlia/lambda-integration-tests branch November 27, 2023 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants