You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Henry Kuijpers (Jira)" <ji...@apache.org> on 2024/04/29 13:07:00 UTC

[jira] [Created] (SLING-12306) Sling mock: JUnit 5 parallel execution results in unregistered adapter factories

Henry Kuijpers created SLING-12306:
--------------------------------------

             Summary: 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
            Reporter: Henry Kuijpers


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)