ops4j / org.ops4j.pax.exam2

Pax Exam is a testing framework for OSGi
https://ops4j1.jira.com/wiki/spaces/PAXEXAM4/
Apache License 2.0
84 stars 100 forks source link

regression: forked container unit tests failing #1056

Open reschke opened 2 years ago

reschke commented 2 years ago
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 commented 2 years ago

cc @jbonofre

oliverlietz commented 2 years ago

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

reschke commented 2 years ago

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.

oliverlietz commented 2 years ago

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.

reschke commented 2 years ago

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

reschke commented 1 year ago

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

laeubi commented 1 year ago

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

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,

splatch commented 1 year ago

@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 commented 1 year ago

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 ;-)).

oliverlietz commented 1 year ago

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

reschke commented 11 months ago

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

Nope.