[ODLPARENT-262] SingleFeatureTest needs to be safe to execute in parallel Created: 29/Sep/21  Updated: 19/Jan/24

Status: In Progress
Project: odlparent
Component/s: SFT
Affects Version/s: None
Fix Version/s: 14.0.0, 13.0.11

Type: New Feature Priority: High
Reporter: Robert Varga Assignee: Ruslan Kashapov
Resolution: Unresolved Votes: 0
Labels: pick-next, pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
blocks ODLPARENT-264 Fix thread safety around depends-mave... Confirmed
blocks BGPCEP-425 bgpcep fails to build when using para... Confirmed
Relates
relates to ODLPARENT-257 Allow SFT to use a test-only dependency Resolved
relates to INFRAUTILS-12 New integration test utilities Resolved
Epic Link: Faster Builds

 Description   

Attempting to run mutlple SFTs, i.e. feature.xml builds, on the same machine is going to lead into failures (the dreaded NotBoundException) due to concurrent Karaf invocation (I think, needs to be tested).
Given that SFT is run through SureFire -> Pax-Exam -> Karaf, we may end up needing to rework this pipeline.

Note that whatever solution we brew up here needs to be licensed under Apache-2.0 license as we will want to contribute it back to karaf (and not deal with maintaining it).



 Comments   
Comment by Robert Varga [ 29/Sep/21 ]

Looking at https://github.com/apache/karaf/blob/e1dde27b88303c78e1d94b3dddaca0ea177e59e5/itests/test/pom.xml#L297-L313 it is clear this is not something solved in upstream and we will need to brew our own solution.

In order to control when a Karaf instance is launched and when not, we will need to attach to Maven reactor, hence this will invariantly include a bespoke maven plugin.

For maintaining reactor-global state we need to do something along the lines of https://github.com/fabric8io/docker-maven-plugin/issues/504 which ends up needing to talk to https://maven.apache.org/ref/3.8.2/maven-core/apidocs/org/apache/maven/execution/MavenSession.html .

That in turn gives us complete visibility into what the entirety of build looks like, with things like getCurrentProject() (hence no need for depends-maven-plugin), getProjects() and getPluginContext() – which should give us enough rope to implement what amounts to a Reactor-global lock we need to ensure there is no reactor-level concurrency around launching Karaf.

Comment by Robert Varga [ 29/Sep/21 ]

For launching Karaf, that does not look like an involved operation: https://github.com/ops4j/org.ops4j.pax.exam2/blob/master/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java#L129 , hence we should be able to brew our own.

All we really need for SFT is to install the needed features and then monitor Karaf and wait for it to settle. I thing all the things we collect in BundleDiagInfosImpl should also be available through Karaf's serviceability features. Certainly the JMX information provided in osgi.core, org.apache.aries.blueprint and org.apache.karaf looks very promising.

Comment by Robert Varga [ 29/Sep/21 ]

As a side note: policy as to whether karaf can be launched concurrently or not depends on networking ports being used.
The first step there would be to reign in opendaylight-karaf-empty's, so that most of odlparent-packaged features can be tested concurrently – which would be an opt-in configured by the SFT-using artifact (based on knowledge of what is being tested). Based on that experience we may provide enough tools for at least some downstreams to the same.

That work is out of scope for this issue, though: for now we will serialize all Karaf tests.

Generated at Wed Feb 07 20:28:03 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.