Skip to content

Enabling Local Testing with RIE and Improving Tests Coverability #560

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 8 commits into from
Aug 21, 2025

Conversation

AntoniaSzecsi
Copy link
Contributor

@AntoniaSzecsi AntoniaSzecsi commented Aug 14, 2025

Issue #, if available:

Description of changes:

Target (OCI, Managed Runtime, both):

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

Description
This PR enhances the aws-lambda-java-runtime-interface-client with local testing capabilities and significantly improves test coverage.

Summary of changes:

  1. Local Testing Support: Added Runtime Interface Emulator (RIE) integration for local development
  • New Dockerfile.rie for containerized local testing
  • Test script test-rie.sh for automated testing workflow
  • EchoHandler for testing purposes
  • Updated Makefile with RIE testing targets
  1. Test Configuration Cleanup: Refine Test Configuration to exclude unnecessary components
  • Exclude compiler-enforced classes (exceptions, interfaces, DTOs)
  • Exclude runtime-only classes: AWSLambda, FrameType, StructuredLogMessage

@@ -74,5 +78,5 @@ TARGETS
dev Run all development tests after a change.
pr Perform all checks before submitting a Pull Request.
test Run the Unit tests.

test-rie Build and test RIC locally with Lambda Runtime Interface Emulator. (Requires building the project first)
Copy link
Member

Choose a reason for hiding this comment

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

nice!

@maxday
Copy link
Member

maxday commented Aug 14, 2025

Thanks @AntoniaSzecsi !
Nice to see coverage bump 👍
LGTM I left only couple of small comments

@maxday
Copy link
Member

maxday commented Aug 14, 2025

Can you change this as well so we won't go lower https://github.com/aws/aws-lambda-java-libs/blob/main/aws-lambda-java-runtime-interface-client/pom.xml#L245
Thanks!

@@ -0,0 +1,8 @@
FROM public.ecr.aws/lambda/java:11
Copy link
Member

Choose a reason for hiding this comment

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

let's use 21?

Copy link

codecov bot commented Aug 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.74%. Comparing base (e54cf69) to head (ec58561).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #560      +/-   ##
============================================
+ Coverage     58.26%   64.74%   +6.47%     
+ Complexity      222      194      -28     
============================================
  Files            46       33      -13     
  Lines          1155      936     -219     
  Branches        149      132      -17     
============================================
- Hits            673      606      -67     
+ Misses          428      281     -147     
+ Partials         54       49       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@darklight3it darklight3it left a comment

Choose a reason for hiding this comment

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

I think we should avoid writing tests just to make the coverage analysis pass. Unit tests should be meaningful and help document how our application actually works.

My suggestion is to evaluate whether what you are testing is truly meaningful, and if not, adjust the coverage tool to exclude it. As a general guideline:

  • Exceptions and simple POJOs are usually excluded from coverage in most projects I’ve seen. Exceptions can be made for classes that exhibit significant behavior.

  • In typed languages, you generally don’t need tests for features already enforced by the compiler (e.g., the Resource interface).

  • Constants and environment variables should only be tested if they are critical to a specific business process, and in that case, the test should focus on where they are used.

Copy link

@darklight3it darklight3it left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@AntoniaSzecsi AntoniaSzecsi requested review from darklight3it and removed request for godcrampy August 20, 2025 09:55
Copy link
Contributor

@PartiallyUntyped PartiallyUntyped left a comment

Choose a reason for hiding this comment

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

Great work on the readme and the test script!

Comment on lines +217 to +234
<configuration>
<excludes>
<!-- Exclude simple exceptions (compiler enforced) -->
<exclude>**/*Exception.class</exclude>
<!-- Exclude interfaces (compiler enforced) -->
<exclude>**/Resource.class</exclude>
<!-- Exclude simple DTOs/POJOs (data containers) -->
<exclude>**/dto/*.class</exclude>
<!-- Exclude constants classes (build-time values) -->
<exclude>**/ReservedRuntimeEnvironmentVariables.class</exclude>
<exclude>**/RapidErrorType.class</exclude>
<!-- Exclude enum-like data holders -->
<exclude>**/FrameType.class</exclude>
<exclude>**/StructuredLogMessage.class</exclude>
<!-- Exclude main entry point (runtime-only) -->
<exclude>**/AWSLambda.class</exclude>
</excludes>
</configuration>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@PartiallyUntyped PartiallyUntyped merged commit 640b766 into main Aug 21, 2025
6 checks passed
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.

4 participants