Skip to content

Conversation

@sharvath-newrelic
Copy link
Contributor

@sharvath-newrelic sharvath-newrelic commented Jan 20, 2026

Overview

Per this PR, classloading issues resulting from the porting of Kotlin lab code have been resolved. Additionally, unit tests for the Kotlin coroutines instrumentation modules (1.4, 1.7 and 1.9) have been added with assertions to verify NR agent behavior. Tests help to verify:

  • Transaction completion counts
  • Transaction name presence
  • Metric generation for instrumented operations
  • Token propagation across async boundaries

It's worth noting async.kt and PauseService.kt were not ported for the following reasons:

  1. async.kt:
    - Contained example code demonstrating async/await patterns but without assertions
    - All patterns have been incorporated into CoroutinesTest.kt with Introspector-based verification
    - The new tests cover the same scenarios (async, awaitAll, multiple deferreds) with agent behavior validation
  2. PauseService.kt:
    - No longer needed as new tests use delay() directly within test methods

Related Github Issue

Resolves #2675
Resolves #2661

Testing

To run the instrumentation tests manually, run the following command template via the terminal:
./gradlew instrumentation:kotlin-coroutines-1.x:test --parallel

@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.31%. Comparing base (cfb7b44) to head (e2107d7).
⚠️ Report is 131 commits behind head on main.

Files with missing lines Patch % Lines
...c/agent/introspec/internal/WeavingClassLoader.java 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2705      +/-   ##
============================================
- Coverage     70.34%   70.31%   -0.03%     
+ Complexity    10123    10119       -4     
============================================
  Files           853      853              
  Lines         41118    41120       +2     
  Branches       6240     6241       +1     
============================================
- Hits          28923    28915       -8     
- Misses         9372     9375       +3     
- Partials       2823     2830       +7     

☔ 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.

@sharvath-newrelic sharvath-newrelic marked this pull request as ready for review January 21, 2026 16:44
@sharvath-newrelic
Copy link
Contributor Author

@dhilpipre This PR does some work to strengthen the Kotlin coroutines test suite. I was curious if you might have any commentary/recommendations for additions or revisions that could be made per this PR?

@dhilpipre
Copy link
Collaborator

@sharvath-newrelic I'll take a look and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Add/refine Kotlin unit tests for ported lab instrumentation Resolve classloading issues in kotlin tests

4 participants