Skip to content

Add end-to-end integration tests#619

Open
fabisev wants to merge 1 commit into
mainfrom
fabisev/integration-tests
Open

Add end-to-end integration tests#619
fabisev wants to merge 1 commit into
mainfrom
fabisev/integration-tests

Conversation

@fabisev

@fabisev fabisev commented Jun 29, 2026

Copy link
Copy Markdown

Add end-to-end integration tests for aws-lambda-java-log4j2
Adds integration tests that deploy a Lambda function using aws-lambda-java-log4j2, invoke it, and verify logs arrive in CloudWatch. This catches the main regression path: Log4j2 plugin discovery failing due to a missing Log4j2Plugins.dat in the shaded JAR.

  • lambda-integration-tests/ - SAM project with a minimal Java Lambda function that logs a unique marker at INFO/DEBUG/WARN/ERROR levels via Log4j2 LambdaAppender
  • run-tests.sh - invokes the function and polls CloudWatch to verify the marker arrived
  • build-integration-test.yml - PR gate that verifies the test function compiles
  • run-integration-test.yml - deploys to AWS, runs the test, cleans up

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

workflow_dispatch:
push:
branches: [ main ]
paths:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here the test should be run for most packages, at least the one that are involved.

core, serialization, runtime-interface-client, log4j and i would also add events.

Comment on lines +1 to +3
# this workflow verifies that the integration test Lambda function builds successfully.
# it does NOT deploy or run the tests (that requires AWS credentials and is done in
# run-integration-test.yml).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Aren't those supposed to fail as well in the run-integration-test. It seems to me that those test s are rebuilt also there.

- uses: actions/checkout@v6

- name: Set up JDK
uses: actions/setup-java@v5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here and in all other references to github actions.


- name: Install log4j2 with Maven
run: |
export JAVA_HOME=$JAVA_HOME_8_X64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's probably correct here. But it is not correct in general.

In Java we have some C++ component that are dependent on the architecture. We should have a look at that together.

The test should be run per arch and probably runtime (I was doing a CR also for that). For the moment it's probably fine.

We should also do this #617

group: integration-test
cancel-in-progress: false
steps:
- uses: actions/checkout@v6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

add the commit sha to prevent supply chain attacks.

# integration test script for aws-lambda-java-log4j2.
# invokes the deployed lambda function and verifies logs appear in CloudWatch.

set -euo pipefail

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For the moment it's sufficient like this but we probably can do something more advanced. For example we can create a Java project that uses a something like JUNIT to run the AWS SDK invoke the function and then get the logs.

In this way we avoid doing scripting and we can also have a nice report for how the test has gone.

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