Skip to content

Commit b336419

Browse files
committed
test(integration): increase HTTP client timeout for Lambda tests
Updated the HTTP client timeout from 30 seconds to 60 seconds in multiple Lambda functional tests to accommodate longer cold start times. This change aims to enhance test reliability and prevent timeouts during integration testing with LocalStack. Changes: - Increased timeout for API Gateway client and redirect client in various test methods. This adjustment addresses potential timing issues and improves the overall stability of the tests.
1 parent 5eedcfb commit b336419

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/Aspire.Hosting.LocalStack.Integration.Tests/Playground/Lambda/LocalStackLambdaFunctionalTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public async Task Redirector_Should_Redirect_To_Original_Url()
7878
{
7979
// Arrange: First create a short URL
8080
using var httpClient = fixture.CreateApiGatewayClient();
81-
httpClient.Timeout = TimeSpan.FromSeconds(30); // Give enough time for Lambda cold start
81+
httpClient.Timeout = TimeSpan.FromSeconds(60);
8282

8383
var createRequest = new { Url = "https://docs.localstack.cloud", Format = (string?)null };
8484
var createResponse = await httpClient.PostAsJsonAsync("/shorten", createRequest, PostJsonOptions, TestContext.Current.CancellationToken);
@@ -93,7 +93,7 @@ public async Task Redirector_Should_Redirect_To_Original_Url()
9393
handler.AllowAutoRedirect = false;
9494
using var redirectClient = new HttpClient(handler);
9595
redirectClient.BaseAddress = httpClient.BaseAddress;
96-
redirectClient.Timeout = TimeSpan.FromSeconds(30);
96+
redirectClient.Timeout = TimeSpan.FromSeconds(60);
9797

9898
var redirectResponse = await redirectClient.GetAsync(new Uri($"/{createResult.Id}", UriKind.Relative), TestContext.Current.CancellationToken);
9999

@@ -162,7 +162,7 @@ public async Task Redirecting_Url_Should_Send_Analytics_Event_And_Be_Processed()
162162
{
163163
// Arrange: First create a short URL
164164
using var httpClient = fixture.CreateApiGatewayClient();
165-
httpClient.Timeout = TimeSpan.FromSeconds(30);
165+
httpClient.Timeout = TimeSpan.FromSeconds(60);
166166

167167
using var dynamoDbClient = LocalStackTestHelpers.CreateDynamoDbClient(fixture.LocalStackConnectionString, fixture.RegionName);
168168
var analyticsTableName = fixture.StackOutputs.GetOutput("AnalyticsTableName")
@@ -185,7 +185,7 @@ public async Task Redirecting_Url_Should_Send_Analytics_Event_And_Be_Processed()
185185
handler.AllowAutoRedirect = false;
186186
using var redirectClient = new HttpClient(handler);
187187
redirectClient.BaseAddress = httpClient.BaseAddress;
188-
redirectClient.Timeout = TimeSpan.FromSeconds(30);
188+
redirectClient.Timeout = TimeSpan.FromSeconds(60);
189189

190190
var redirectResponse = await redirectClient.GetAsync(new Uri($"/{createResult.Id}", UriKind.Relative), TestContext.Current.CancellationToken);
191191
Assert.Equal(HttpStatusCode.Found, redirectResponse.StatusCode);

0 commit comments

Comments
 (0)