Anshul-creator commented on PR #15744:
URL: https://github.com/apache/dubbo/pull/15744#issuecomment-3492632768
Thanks for the review!
I believe there might be a small misunderstanding...this PR doesn’t
introduce new behavior that needs its own unit test. It fixes order-dependent
flakiness in the existing test `ExtensionLoaderTest.testInjectExtension`
Before this change, the `ExtensionLoader` classes' tests, particularly
`testGetOrDefaultExtension` (polluter) and `testInjectExtension` (victim)
interfered with each other via shared `ScopeBeanFactory` state. Running the
shell command below exposes this flakiness:
```bash
fail=0; total=0
for s in 7138 7351 7892 11170 15857 15869 17721 20421 21699 22631 24059
29905; do
echo "SEED=$s"
total=$((total+1))
SEED=$s ./mvnw -pl dubbo-common -DfailIfNoTests=true -DforkCount=1
-DreuseForks=false \
-Dsurefire.runOrder=random \
-Djunit.jupiter.testclass.order.default=org.junit.jupiter.api.ClassOrderer\$Random
\
-Djunit.jupiter.testmethod.order.default=org.junit.jupiter.api.MethodOrderer\$Random
\
-Djunit.jupiter.testclass.order.random.seed="$s" \
-Djunit.jupiter.testmethod.order.random.seed="$s" \
-Dtest=org.apache.dubbo.common.extension.ExtensionLoaderTest test \
>/dev/null || { echo "** FAILED on SEED=$s **"; fail=$((fail+1)); }
done
echo
echo "===== SUMMARY ====="
echo "Total seeds: $total"
echo "Failed: $fail"
echo "Passed: $((total - fail))"
echo "==================="
```
These seeds reliably reproduce the flakiness on the pre-fix code.
I attempted to simplify this to a single command (e.g., running the polluter
→ victim pair deterministically), but Surefire didn’t consistently preserve the
inter-test interference needed to trigger the bug. The above loop was therefore
the most reliable way to demonstrate the issue.
After this fix, none of these seeds fail. The test is now stable under any
random execution order.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]