Skip to content

chore: fix e2e tests #875

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion libraries/tests/e2e/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Navigate to the directory containing your CDK stacks and deploy them:
cd infra
cdk deploy --require-approval never
cd ../infra-aot
cdk deploy --require-approval never
cdk deploy CoreStack --require-approval never --context architecture=arm64
```
### 3. Run the tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,54 +173,24 @@ private void AssertEventLog(string functionName, bool isColdStart, string output

Assert.True(messageElement.TryGetProperty("HttpMethod", out JsonElement httpMethodElement));
Assert.Equal("POST", httpMethodElement.GetString());

Assert.True(messageElement.TryGetProperty("Headers", out JsonElement headersElement));
Assert.True(headersElement.TryGetProperty("Accept-Encoding", out JsonElement acceptEncodingElement));
Assert.Equal("gzip, deflate, sdch", acceptEncodingElement.GetString());

Assert.True(headersElement.TryGetProperty("Accept-Language", out JsonElement acceptLanguageElement));
Assert.Equal("en-US,en;q=0.8", acceptLanguageElement.GetString());

Assert.True(headersElement.TryGetProperty("Cache-Control", out JsonElement cacheControlElement));
Assert.Equal("max-age=0", cacheControlElement.GetString());

Assert.True(
messageElement.TryGetProperty("QueryStringParameters", out JsonElement queryStringParametersElement));
Assert.True(queryStringParametersElement.TryGetProperty("Foo", out JsonElement fooElement));
Assert.Equal("bar", fooElement.GetString());


Assert.True(messageElement.TryGetProperty("RequestContext", out JsonElement requestContextElement));
Assert.True(requestContextElement.TryGetProperty("Path", out JsonElement requestContextPathElement));
Assert.Equal("/prod/path/to/resource", requestContextPathElement.GetString());

Assert.True(requestContextElement.TryGetProperty("AccountId", out JsonElement accountIdElement));
Assert.Equal("123456789012", accountIdElement.GetString());

Assert.True(requestContextElement.TryGetProperty("ResourceId", out JsonElement resourceIdElement));
Assert.Equal("123456", resourceIdElement.GetString());

Assert.True(requestContextElement.TryGetProperty("Stage", out JsonElement stageElement));
Assert.Equal("prod", stageElement.GetString());


Assert.True(requestContextElement.TryGetProperty("RequestId", out JsonElement requestIdElement));
Assert.Equal("c6af9ac6-7b61-11e6-9a41-93e8deadbeef", requestIdElement.GetString());

Assert.True(requestContextElement.TryGetProperty("ResourcePath", out JsonElement resourcePathElement));
Assert.Equal("/{proxy+}", resourcePathElement.GetString());


Assert.True(
requestContextElement.TryGetProperty("HttpMethod", out JsonElement requestContextHttpMethodElement));
Assert.Equal("POST", requestContextHttpMethodElement.GetString());

Assert.True(requestContextElement.TryGetProperty("ApiId", out JsonElement apiIdElement));
Assert.Equal("1234567890", apiIdElement.GetString());

Assert.True(requestContextElement.TryGetProperty("RequestTime", out JsonElement requestTimeElement));
Assert.Equal("09/Apr/2015:12:34:56 +0000", requestTimeElement.GetString());

Assert.True(requestContextElement.TryGetProperty("RequestTimeEpoch", out JsonElement requestTimeEpochElement));
Assert.Equal(1428582896000, requestTimeEpochElement.GetInt64());

Assert.True(messageElement.TryGetProperty("Body", out JsonElement bodyElement));
Assert.Equal("hello world", bodyElement.GetString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public FunctionTests(ITestOutputHelper testOutputHelper)

[Trait("Category", "AOT")]
[Theory]
[InlineData("E2ETestLambda_X64_AOT_NET8_metrics")]
[InlineData("E2ETestLambda_ARM_AOT_NET8_metrics")]
[InlineData("E2ETestLambda_X64_AOT_NET8_metrics_AOT-Function")]
[InlineData("E2ETestLambda_ARM_AOT_NET8_metrics_AOT-Function")]
public async Task AotFunctionTest(string functionName)
{
_functionName = functionName;
Expand Down Expand Up @@ -317,6 +317,6 @@ private async Task ForceColdStart()

_ = await _lambdaClient.UpdateFunctionConfigurationAsync(updateRequest);

await Task.Delay(2000);
await Task.Delay(15000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public FunctionTests(ITestOutputHelper testOutputHelper)

[Trait("Category", "AOT")]
[Theory]
[InlineData("E2ETestLambda_X64_AOT_NET8_tracing")]
[InlineData("E2ETestLambda_ARM_AOT_NET8_tracing")]
[InlineData("E2ETestLambda_X64_AOT_NET8_tracing_AOT-Function")]
[InlineData("E2ETestLambda_ARM_AOT_NET8_tracing_AOT-Function")]
public async Task AotFunctionTest(string functionName)
{
await TestFunction(functionName);
Expand Down
11 changes: 0 additions & 11 deletions libraries/tests/e2e/functions/payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,12 @@
"path": "/path/to/resource",
"httpMethod": "POST",
"isBase64Encoded": false,
"queryStringParameters": {
"foo": "bar"
},
"headers": {
"Accept-Encoding": "gzip, deflate, sdch",
"Accept-Language": "en-US,en;q=0.8",
"Cache-Control": "max-age=0"
},
"requestContext": {
"accountId": "123456789012",
"resourceId": "123456",
"stage": "prod",
"requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
"requestTime": "09/Apr/2015:12:34:56 +0000",
"requestTimeEpoch": 1428582896000,
"path": "/prod/path/to/resource",
"resourcePath": "/{proxy+}",
"httpMethod": "POST",
"apiId": "1234567890",
"protocol": "HTTP/1.1"
Expand Down
2 changes: 1 addition & 1 deletion libraries/tests/e2e/infra-aot/CoreAotStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void CreateFunctionConstructs(string utility, string function = "AOT-Fun
Name = $"E2ETestLambda_{arch}_AOT_NET8_{utility}_{function}",
SourcePath = baseAotPath,
DistPath = distAotPath,
Handler = $"{function}.Function::AWS.Lambda.Powertools.{utility}.{function}.Function.FunctionHandler"
Handler = function
};

CreateFunctionConstruct(construct);
Expand Down
Loading