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

Update TestToolv2 Lambda Runtime API for multi function and RequestResponse mode #1912

Open
wants to merge 1 commit into
base: feature/lambdatesttool-v2
Choose a base branch
from

Conversation

normj
Copy link
Member

@normj normj commented Dec 20, 2024

Description of changes:
Updated the Lambda Runtime API to partition the events for being processed by function name. That is done by a new IRuntimeApiDataStoreManager that is basically a dictionary of IRuntimeApiDataStore per function names.

Also the InvocationType on the Lambda invoke method is now honored returning back a response when InvocationType is set to RequestResponse. This required adding a ManualResetEventSlim to the queued events to synchronized sending a response back to the caller of the invoke with when the Lambda function reports completion.

Work to be done in future PRs to keep this PR small.

  • Update the test tool UI to show list of listening functions. Right now it is stubbed to only handle events for the default function.
  • Communicate error responses from the Lambda function back to the caller in RequestResponse mode.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


if (!string.IsNullOrEmpty(evnt.Response))
{
var responseData = Encoding.UTF8.GetBytes(evnt.Response);
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the use of using IResult because they were adding another layer of JSON encoding that was altering the JSON sent by the Lambda function.

…ening function and support for RequestResponse invocation type.
@normj normj force-pushed the normj/testtool-vs-add-datastore-manager branch from 9403f85 to 79ef0b5 Compare December 20, 2024 02:20
@@ -0,0 +1,2 @@

[assembly: Xunit.CollectionBehavior(DisableTestParallelization = true)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Because the unit tests involve setting environment variables for Amazon.Lambda.RuntimeSupport I disabled test parallelization to avoid flakiness running the tests.

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.

2 participants