Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-74787

BaseTestRule throws NullPointerException on gradlew testIntegration with individual test methods

    Details

      Description

      Attempting to run individual test methods of an integration test class produces a `NullPointerException` from `BaseTestRule`.

      ==> modules/apps/foundation/users-admin/users-admin-test 

      `gradlew testIntegration com.liferay.users.admin.indexer.test.UserIndexerTest.testScreenName`

      or

      `gradlew testIntegration com.liferay.users.admin.indexer.test.UserIndexerTest.testS*`

      throws

      ```
      java.lang.NullPointerException
      at com.liferay.portal.kernel.test.rule.BaseTestRule$3.evaluate(BaseTestRule.java:117)
      at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      at com.liferay.arquillian.extension.junit.bridge.observer.JUnitBridgeObserver.evaluateWithClassRule(JUnitBridgeObserver.java:153)
      at com.liferay.arquillian.extension.junit.bridge.observer.JUnitBridgeObserver.aroundTest(JUnitBridgeObserver.java:118)
      ```

      NPE happens here, in `deque`:

      https://github.com/liferay/liferay-portal/blob/add87315cc4859799baa0f3614ae200a720582fe/portal-test/src/com/liferay/portal/kernel/test/rule/BaseTestRule.java#L117

      Debugging shows this is supposed to initialize the map, but it's only called when running a whole class, not specific methods:

      https://github.com/liferay/liferay-portal/blob/add87315cc4859799baa0f3614ae200a720582fe/portal-test/src/com/liferay/portal/kernel/test/rule/BaseTestRule.java#L97-L107

      So `_classCarryOnMap` never gets populated, hence the NPE later.

      Maybe related, maybe not:

      ==> modules/apps/foundation/portal-search/portal-search-test

      `gradlew testIntegration com.liferay.portal.search.facet.faceted.searcher.test.AssetEntriesFacetedSearcherTest.testAggregation`

      will pass the first time it runs. The second time it runs, though, the test freezes and never finishes. Portal must be restarted in order to run the test again.

      However, running the entire class instead of an individual method passes consistently no matter how many consecutive times it runs:

      `gradlew testIntegration com.liferay.portal.search.facet.faceted.searcher.test.AssetEntriesFacetedSearcherTest`

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            andre.oliveira André Ricardo Barreto de Oliveira
            Participants of an Issue:
            Recent user:
            Enterprise Release HU
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              4 years, 11 weeks ago

                Packages

                Version Package
                7.1.X
                Master