org.ops4j.pax.exam2 icon indicating copy to clipboard operation
org.ops4j.pax.exam2 copied to clipboard

regression: forked container unit tests failing

Open reschke opened this issue 3 years ago • 11 comments

18 [main] INFO org.ops4j.pax.exam.junit.DriverExtension - creating PaxExam runner for class org.ops4j.pax.exam.forked.ReferenceJarTest
73 [main] INFO org.ops4j.pax.exam.spi.DefaultExamSystem - Pax Exam System (Version: 5.0.0-SNAPSHOT) created.
Running org.ops4j.pax.exam.forked.ForkedFrameworkFactoryTest
1020 [main] INFO org.ops4j.pax.exam.ExamJavaRunner - ExamJavaRunner completed successfully

1021 [main] INFO org.ops4j.pax.exam.forked.ForkedFrameworkFactory - Connecting to host: 127.0.0.1 port: 21000
3473 [main] INFO org.ops4j.pax.exam.ExamJavaRunner - ExamJavaRunner completed successfully

3473 [main] INFO org.ops4j.pax.exam.forked.ForkedFrameworkFactory - Connecting to host: 127.0.0.1 port: 21001

8649 [main] INFO org.ops4j.pax.exam.ExamJavaRunner - Platform has been shutdown.
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 7.713 sec <<< FAILURE! - in org.ops4j.pax.exam.forked.ForkedFrameworkFactoryTest
forkEquinox(org.ops4j.pax.exam.forked.ForkedFrameworkFactoryTest)  Time elapsed: 2.497 sec  <<< ERROR!
java.rmi.ServerError: Error occurred in server thread; nested exception is:
        java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

Downgrading the swissbox dependency to 1.8.3 fixes the issue (that is, reverting #1021)

reschke avatar Mar 28 '22 07:03 reschke

cc @jbonofre

reschke avatar Mar 28 '22 07:03 reschke

@reschke Does downgrading Swissbox in 4.13.6-SNAPSHOT also fix the issue?

oliverlietz avatar Jun 19 '22 11:06 oliverlietz

I don't quiet understand the question - the bug report is for what's current in "master"; and that hasn't changed since Nov 2021.

reschke avatar Jun 19 '22 14:06 reschke

There is a regression in versions newer 4.13.3 which could be the same or similar and prevents me from upgrading Pax Exam in several Sling projects. Never mind, I will investigate when back at desk.

oliverlietz avatar Jun 19 '22 14:06 oliverlietz

Yes, I believe we talk about the same regression (or multiple ones).

reschke avatar Jun 19 '22 15:06 reschke

Just checking: is anybody actually working actively on pax-exam?

reschke avatar Jun 20 '23 07:06 reschke

Not that I'm aware of depending on your needs osgi-test might be a more lightweight alternative:

  • https://github.com/osgi/osgi-test
  • https://github.com/laeubisoft/osgi-test-framework

but it is all open source so if you want open a PR with a fix and I think it could be merged without much issues,

laeubi avatar Jun 20 '23 10:06 laeubi

@reschke I intended to do some work around junit 5 support and relatives, however ended up not doing so yet. Mean while other project where I worked with where I expected to see more pax-exam decided to go with test containers as a more consistent way for testing multiple things. We do have some Karaf integration tests, which normally would work with pax: https://github.com/OpenNMS-Cloud/lokahi/blob/v0.0.42-dev/minion/docker-it/src/test/java/org/opennms/horizon/dockerit/testcontainers/TestContainerRunnerClassRule.java

Main difference there is - you can verify system behavior. If you are still interested in asserting internal state of framework or supplied extensions - exam or tools pointed by @laeubi is way to go, as it will give you access to all low level details. For any system level testing test-containers will do the job. I hope to put some more effort into ConnectorIO/connectorio-addons#5 in July and make it a drop-in replacement of higher level tests.

splatch avatar Jun 20 '23 19:06 splatch

FYI, I've extracted some of the code from that repository into separate repository. I made also an attempt to separate container handling from customization (what we know as exam options) so they can be applied across different distributions. I'll continue working on it further: https://github.com/ConnectorIO/connectorio-testcontainers and try to see how it will work with integration tests for openHAB (readme is missing for now ;-)).

splatch avatar Jun 23 '23 16:06 splatch

@reschke, Were you able to identify the change in Swissbox which is causing the issue?

oliverlietz avatar Aug 13 '23 18:08 oliverlietz

@reschke, Were you able to identify the change in Swissbox which is causing the issue?

Nope.

reschke avatar Sep 29 '23 12:09 reschke

The issue was caused by the introduction of Logger and LoggerFactory into ServiceLookup in commit ed0dccb.

oliverlietz avatar Oct 26 '24 11:10 oliverlietz

Fixed by #1124.

oliverlietz avatar Nov 04 '24 17:11 oliverlietz