From 7e72cffcdb300cb020dd957b7195aefbcd35870b Mon Sep 17 00:00:00 2001 From: Norm Johanson Date: Wed, 4 Sep 2024 15:29:14 -0700 Subject: [PATCH 1/3] Disable NativeAOT test for CI due to lack of Native AOT prereqs in CI system. --- .../BaseCustomRuntimeTest.cs | 2 ++ .../Amazon.Lambda.RuntimeSupport.UnitTests/NativeAOTTests.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.IntegrationTests/BaseCustomRuntimeTest.cs b/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.IntegrationTests/BaseCustomRuntimeTest.cs index a0a67f242..5b2741b5f 100644 --- a/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.IntegrationTests/BaseCustomRuntimeTest.cs +++ b/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.IntegrationTests/BaseCustomRuntimeTest.cs @@ -189,6 +189,8 @@ private async Task DeleteDeploymentZipAndBucketAsync(IAmazonS3 s3Client, string protected async Task InvokeFunctionAsync(IAmazonLambda lambdaClient, string payload) { + await WaitForFunctionToBeReady(lambdaClient); + var request = new InvokeRequest { FunctionName = FunctionName, diff --git a/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/NativeAOTTests.cs b/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/NativeAOTTests.cs index ae7f7aaf7..5b1738642 100644 --- a/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/NativeAOTTests.cs +++ b/Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/NativeAOTTests.cs @@ -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"); From ca144772928f33d9c17e5c2566bd6a5ad5c0f747 Mon Sep 17 00:00:00 2001 From: Norm Johanson Date: Thu, 5 Sep 2024 09:04:44 -0700 Subject: [PATCH 2/3] Add a wait after integ test CloudFormation deployment to wait for any eventually consistency sync up. --- .../CustomResponse.cs | 37 +++++++++++++++++-- .../IntegrationTestContextFixture.cs | 3 ++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/Libraries/test/TestServerlessApp.IntegrationTests/CustomResponse.cs b/Libraries/test/TestServerlessApp.IntegrationTests/CustomResponse.cs index 3d987c391..433adac4d 100644 --- a/Libraries/test/TestServerlessApp.IntegrationTests/CustomResponse.cs +++ b/Libraries/test/TestServerlessApp.IntegrationTests/CustomResponse.cs @@ -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; @@ -21,7 +22,7 @@ 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()); } @@ -29,7 +30,7 @@ public async Task OkResponseWithHeader_Returns200Status() [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); @@ -41,7 +42,7 @@ 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(); @@ -49,5 +50,35 @@ public async Task OkResponseWithCustomSerializer_Returns200Status() Assert.Equal("John", person["FIRST_NAME"]); Assert.Equal("Doe", person["LAST_NAME"]); } + + private async Task 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; + } } } diff --git a/Libraries/test/TestServerlessApp.IntegrationTests/IntegrationTestContextFixture.cs b/Libraries/test/TestServerlessApp.IntegrationTests/IntegrationTestContextFixture.cs index b5e27f60a..cbae5fd6a 100644 --- a/Libraries/test/TestServerlessApp.IntegrationTests/IntegrationTestContextFixture.cs +++ b/Libraries/test/TestServerlessApp.IntegrationTests/IntegrationTestContextFixture.cs @@ -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() From cdaef1c8aa9610a6e68f22e2389f29ba56b41fbc Mon Sep 17 00:00:00 2001 From: Norm Johanson Date: Thu, 5 Sep 2024 16:47:58 -0700 Subject: [PATCH 3/3] Update RELEASE.CHANGELOG.md --- RELEASE.CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/RELEASE.CHANGELOG.md b/RELEASE.CHANGELOG.md index 87dffc74c..f3e361725 100644 --- a/RELEASE.CHANGELOG.md +++ b/RELEASE.CHANGELOG.md @@ -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.