[
https://issues.apache.org/jira/browse/SLING-12306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17874820#comment-17874820
]
Stefan Seifert commented on SLING-12306:
----------------------------------------
i've seen this problem from time to time, but rather rarely, pop up in the unit
test of wcm.io modules as well, but could not pin down the root cause.
in SLING-12352 you wrote that you see a direct relation to this issue. do you
think this is solved, or that the problem might be directly related to the code
that is now loaded lazily with SLING-12352?
i'm wondering if there is a way to write a unit test to reproduce this problem,
or somehow force it occurence by certain conditions.
> Sling mock: JUnit 5 parallel execution results in unregistered adapter
> factories
> --------------------------------------------------------------------------------
>
> Key: SLING-12306
> URL: https://issues.apache.org/jira/browse/SLING-12306
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Reporter: Henry Kuijpers
> Priority: Major
>
> We have junit-jupiter.properties:
> {code:java}
> junit.jupiter.execution.parallel.enabled = true
> junit.jupiter.execution.parallel.mode.default = same_thread
> junit.jupiter.execution.parallel.mode.classes.default = concurrent {code}
> And this results, randomly everytime, in lots of tests failing because of
> missing adapter factories.
>
> We sometimes see that `boundAdapterFactories` is an empty list. Sometimes we
> see that `factoryCache` is a filled map, with all value lists empty.
>
> We usually see the expected `descriptors` having variable content. One time
> it has 4 entries for o.a.s.a.r.Resource, the other run it has 5 entries.
>
> I believe this is a concurrency issue somehow. I can reproduce it on older
> versions as well (previously we couldn't). So there could also be something
> with dependencies involved.
>
> ----
> More specifically, we seem to get a lot of these stack traces like this:
> {code:java}
> java.lang.RuntimeException: No page manager.
> at
> io.wcm.testing.mock.aem.context.AemContextImpl.pageManager(AemContextImpl.java:169)
> at
> io.wcm.testing.mock.aem.context.AemContextImpl.currentPage(AemContextImpl.java:229)
> {code}
> (also posting this for findability on search engines)
> And also a lot of cases where a Resource cannot be adapted to a ValueMap for
> example.
> Which boils down to the adapter factory that can adapt a ResourceResolver to
> a PageManager, missing or actually not registered yet.
> We do have the proper @ExtendWith etc setup.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)