Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-12306

Sling mock: JUnit 5 parallel execution results in unregistered adapter factories

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Testing
    • None

    Description

      We have junit-jupiter.properties:

      junit.jupiter.execution.parallel.enabled = true
      junit.jupiter.execution.parallel.mode.default = same_thread
      junit.jupiter.execution.parallel.mode.classes.default = concurrent 

      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:

      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) 

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            Henry Kuijpers Henry Kuijpers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: