Skip to content

test: fix NPE in child context completion tests - #729

Merged
zhongkechen merged 1 commit into
aws:mainfrom
zhongkechen:fix/java-unit-test-completion-lock-npe
Sep 22, 2026
Merged

zhongkechen merged 1 commit into
aws:mainfrom
zhongkechen:fix/java-unit-test-completion-lock-npe

Conversation

@zhongkechen

Copy link
Copy Markdown
Contributor

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

Issue Link, if available

No tracking issue. Reproduced from the main-branch Build run, where all three Java versions log this NPE while the tests pass.

Description

The two ChildContextOperationTest cases for an already-completed parent use a constructor-free Mockito parent whose completionFuture is null. When a child finishes, completionLock() returns that null future and the background handler throws an NPE. The tests previously only slept and checked for absent checkpoints, so both still passed.

Construct and complete a real ParallelOperation parent so its completion lock is initialized. Wait for each child handler with a bounded timeout and assert that the child completed before checking that its success/failure checkpoint was skipped. Background handler failures now fail the tests.

Demo/Screenshots

Reproduction and regression validation:

  • Original tests: 13 pass, but two background NullPointerException traces are logged.
  • Add the bounded handler waits before fixing the parent: both affected tests fail with ExecutionException wrapping the null completion-lock error.
  • Apply the initialized-parent fix: all 13 tests pass without NPEs on Java 17 and Java 25.

Checklist

  • I have filled out every section of the PR template
  • I have thoroughly tested this change

Testing

Unit Tests

Strengthened both existing success/failure cases. Passed:

  • mvn -B -pl sdk spotless:apply test -Dtest=ChildContextOperationTest on Java 17.
  • mvn -B test spotless:check on Java 17: 2,016 tests passed, 31 skipped, zero failures/errors; all reactor modules and formatting checks passed. No NPEs in the full test log.
  • mvn -B -pl sdk -Dtest=ChildContextOperationTest test on Java 25: 13 passed.

Integration Tests

The full reactor run includes all 405 local SDK integration tests, which passed. No new integration tests are needed for this test-fixture fix. Cloud and external conformance tests were not run.

Examples

No new example is needed. The existing example tests ran as part of the reactor, with opt-in cloud tests skipped.

@zhongkechen
zhongkechen requested a review from a team September 22, 2026 22:17
@zhongkechen
zhongkechen temporarily deployed to ai-pr-review-runtime September 22, 2026 22:17 — with GitHub Actions Inactive
@zhongkechen
zhongkechen merged commit 518cba1 into aws:main Sep 22, 2026
23 of 25 checks passed

This branch was previously deployed

1 inactive deployment
ai-pr-review-runtime — a32a9379 Deployed Sep 22, 2026 by zhongkechen via notify / Generate notification summary #173
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