Skip to content

Sync up dev #1806

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

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ private async Task DeleteDeploymentZipAndBucketAsync(IAmazonS3 s3Client, string

protected async Task<InvokeResponse> InvokeFunctionAsync(IAmazonLambda lambdaClient, string payload)
{
await WaitForFunctionToBeReady(lambdaClient);

var request = new InvokeRequest
{
FunctionName = FunctionName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public NativeAOTTests(ITestOutputHelper output)
_output = output;
}

#if DEBUG // Only running this test right now in local environment because CI system doesn't have Native AOT prereqs installed.
[Fact]
#endif
public void EnsureNoTrimWarningsDuringPublish()
{
var projectDirectory = FindProject("NativeAOTFunction");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Xunit;
Expand All @@ -21,15 +22,15 @@ public CustomResponse(IntegrationTestContextFixture fixture)
[Fact]
public async Task OkResponseWithHeader_Returns200Status()
{
var response = await _fixture.HttpClient.GetAsync($"{_fixture.RestApiUrlPrefix}/okresponsewithheader/1");
var response = await GetWithRetryAsync($"{_fixture.RestApiUrlPrefix}/okresponsewithheader/1");
response.EnsureSuccessStatusCode();
Assert.Equal("All Good", await response.Content.ReadAsStringAsync());
}

[Fact]
public async Task OkResponseWithHeader_ReturnsValidationErrors()
{
var response = await _fixture.HttpClient.GetAsync($"{_fixture.RestApiUrlPrefix}/okresponsewithheader/hello");
var response = await GetWithRetryAsync($"{_fixture.RestApiUrlPrefix}/okresponsewithheader/hello");
Assert.Equal(400, (int)response.StatusCode);
var content = await response.Content.ReadAsStringAsync();
var errorJson = JObject.Parse(content);
Expand All @@ -41,13 +42,43 @@ public async Task OkResponseWithHeader_ReturnsValidationErrors()
[Fact]
public async Task OkResponseWithCustomSerializer_Returns200Status()
{
var response = await _fixture.HttpClient.GetAsync($"{_fixture.HttpApiUrlPrefix}/okresponsewithcustomserializerasync/John/Doe");
var response = await GetWithRetryAsync($"{_fixture.HttpApiUrlPrefix}/okresponsewithcustomserializerasync/John/Doe");
response.EnsureSuccessStatusCode();

var content = await response.Content.ReadAsStringAsync();
var person = JObject.Parse(content);
Assert.Equal("John", person["FIRST_NAME"]);
Assert.Equal("Doe", person["LAST_NAME"]);
}

private async Task<HttpResponseMessage> GetWithRetryAsync(string path)
{
int MAX_ATTEMPTS = 10;
HttpResponseMessage response = null;
for (var retryAttempt = 0; retryAttempt < MAX_ATTEMPTS; retryAttempt++)
{
await Task.Delay(retryAttempt * 1000);
try
{
response = await _fixture.HttpClient.GetAsync(path);

// No tests are coded to return 403 Forbidden. If this is returned it is likely
// an eventual consistency issue.
if (response.StatusCode == System.Net.HttpStatusCode.Forbidden)
continue;

break;
}
catch
{
if (retryAttempt + 1 == MAX_ATTEMPTS)
{
throw;
}
}
}

return response;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public async Task InitializeAsync()
Assert.False(string.IsNullOrEmpty(RestApiUrlPrefix));

await LambdaHelper.WaitTillNotPending(LambdaFunctions.Select(x => x.Name).ToList());

// Wait an additional 10 seconds for any other eventually consistency state to finish up.
await Task.Delay(10000);
}

public async Task DisposeAsync()
Expand Down
12 changes: 12 additions & 0 deletions RELEASE.CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
### Release 2024-09-05
* **Amazon.Lambda.RuntimeSupport (1.11.0)**
* Add support for structured logging. Access to structured logging is pending a deployment of Amazon.Lambda.RuntimeSupport to the managed runtime. Follow GitHub issue https://github.com/aws/aws-lambda-dotnet/issues/1747 for status updates on deployment.
* **Amazon.Lambda.Core (2.3.0)**
* Add preview parameterized logging APIs to the ILogger interface. The API will be in preview till the completion of Amazon.Lambda.RuntimeSupport being deployed to the managed runtime.
* **Amazon.Lambda.AspNetCoreServer (9.0.1)**
* Add application/wasm to list of content types that should be base 64 encoded.
* **Amazon.Lambda.AspNetCoreServer.Hosting (1.7.1)**
* Updated reference of Amazon.Lambda.AspNetCoreServer to 9.0.1
* **Amazon.Lambda.CognitoEvents (4.0.0)**
* **Breaking Change** Corrected the data type for ClaimsToAddOrOverride property in IdTokenGeneration and AccessTokenGeneration classes for CognitoPreTokenGenerationV2Event.

### Release 2024-08-14
* **Amazon.Lambda.Serialization.Json (2.2.3)**
* Fixed an issue in `JsonSerializer` where `JsonSerializerSettings.NullValueHandling` was being set to `NullValueHandling.Ignore` after custom settings were applied.
Expand Down
Loading