[CONTROLLER-1799] Archetype should self test during Maven build Created: 27/Nov/17  Updated: 30/Jan/18  Resolved: 30/Jan/18

Status: Resolved
Project: controller
Component/s: None
Affects Version/s: None
Fix Version/s: Oxygen

Type: Improvement Priority: Medium
Reporter: Michael Vorburger Assignee: Michael Vorburger
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
blocks CONTROLLER-1800 Archetype fully working and self-tested Resolved
is blocked by CONTROLLER-1728 startup archetype upgrade to karaf 4 Resolved

 Description   

CONTROLLER-1728 at the time did not manage to get the archetype "self testing" to work.

It's currently disabled by <archetype.test.skip>true in controller/opendaylight/archetypes/pom.xml.

The goal of this issue is to make that work.



 Comments   
Comment by Michael Vorburger [ 27/Nov/17 ]

As per https://lists.opendaylight.org/pipermail/controller-dev/2017-September/013889.html :

this is how to repro. the problem we saw on Jenkins locally:

rm -rf ~/.m2/repository/org/opendaylight/odlparent
mvn -Dmaven.repo.local=/tmp/Bug8741-archetype-repo clean install

and it will fail like this:

[INFO] [INFO] --- maven-surefire-plugin:2.18.1:test (default) @ odl-basic-api ---
[INFO] [INFO] Surefire report directory: /home/vorburger/dev/ODL/git/controller/opendaylight/archetypes/opendaylight-startup/target/test-classes/projects/basic/project/basic/features/odl-X-api/target/surefire-reports
[INFO] 
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.opendaylight.odlparent.featuretest.SingleFeatureTest
[INFO] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 6.693 sec <<< FAILURE! - in org.opendaylight.odlparent.featuretest.SingleFeatureTest
[INFO] installFeatureCatchAndLog(org.opendaylight.odlparent.featuretest.SingleFeatureTest)[repoUrl: file:/home/vorburger/dev/ODL/git/controller/opendaylight/archetypes/opendaylight-startup/target/test-classes/projects/basic/project/basic/features/odl-X-api/target/feature/feature.xml, Feature: odl-basic-api 0.0.1.SNAPSHOT] Time elapsed: 6.311 sec <<< ERROR!
[INFO] shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Error resolving artifact org.opendaylight.odlparent:opendaylight-karaf-empty:zip:2.0.5
[INFO] at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
[INFO] at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
[INFO] at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
[INFO] at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
[INFO] at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:705)
[INFO] at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:659)
[INFO] at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:600)
[INFO] at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:567)
[INFO] at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:557)
[INFO] at org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:123)
[INFO] at java.net.URL.openStream(URL.java:1045)
[INFO] at org.ops4j.pax.exam.karaf.container.internal.ArchiveExtractor.extractZipDistribution(ArchiveExtractor.java:88)
[INFO] at org.ops4j.pax.exam.karaf.container.internal.ArchiveExtractor.extract(ArchiveExtractor.java:67)
[INFO] at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:155)
[INFO] at org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:79)
[INFO] at org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:267)
[INFO] at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
[INFO] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
[INFO] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
[INFO] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
[INFO] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
[INFO] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
[INFO] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
[INFO] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
[INFO] at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
[INFO] at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:98)
[INFO] at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
[INFO] at org.opendaylight.odlparent.featuretest.PerFeatureRunner.run(PerFeatureRunner.java:72)
[INFO] at org.opendaylight.odlparent.featuretest.PerRepoTestRunner.runChild(PerRepoTestRunner.java:153)
[INFO] at org.opendaylight.odlparent.featuretest.PerRepoTestRunner.runChild(PerRepoTestRunner.java:28)
[INFO] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
[INFO] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
[INFO] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
[INFO] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
[INFO] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
[INFO] at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
[INFO] at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
[INFO] at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
[INFO] at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
[INFO] at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
[INFO] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
[INFO] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
[INFO] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
[INFO] 
[INFO] 
[INFO] Results :
[INFO] 
[INFO] Tests in error: 
[INFO] Error resolving artifact org.opendaylight.odlparent:opendaylight-karaf-empty:zip:2.0.5
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Reactor Summary:
[INFO] [INFO] 
[INFO] [INFO] ODL :: archetype.it :: basic-api ................... SUCCESS [ 20.375 s]
[INFO] [INFO] ODL :: archetype.it :: basic-impl .................. SUCCESS [ 8.691 s]
[INFO] [INFO] OpenDaylight :: basic :: API [Karaf Feature] ....... FAILURE [ 14.891 s]
[INFO] [INFO] ODL :: archetype.it :: features-basic .............. SKIPPED
[INFO] [INFO] ODL :: archetype.it :: basic-karaf ................. SKIPPED
[INFO] [INFO] OpenDaylight :: basic :: Impl [Karaf Feature] ...... SKIPPED
[INFO] [INFO] ODL :: archetype.it :: basic-cli ................... SKIPPED
[INFO] [INFO] OpenDaylight :: basic :: CLI [Karaf Feature] ....... SKIPPED
[INFO] [INFO] OpenDaylight :: basic :: REST [Karaf Feature] ...... SKIPPED
[INFO] [INFO] ODL :: archetype.it :: basic-features-aggregator ... SKIPPED
[INFO] [INFO] ODL :: archetype.it :: basic-artifacts ............. SKIPPED
[INFO] [INFO] basic .............................................. SKIPPED
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 46.338 s
[INFO] [INFO] Finished at: 2017-11-27T16:44:01+01:00
[INFO] [INFO] Final Memory: 212M/1646M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default) on project odl-basic-api: There are test failures.
[INFO] [ERROR] 
[INFO] [ERROR] Please refer to /home/vorburger/dev/ODL/git/controller/opendaylight/archetypes/opendaylight-startup/target/test-classes/projects/basic/project/basic/features/odl-X-api/target/surefire-reports for the individual test results.
[INFO] [ERROR] -> [Help 1]
[INFO] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default) on project odl-basic-api: There are test failures.
[INFO] 
[INFO] Please refer to /home/vorburger/dev/ODL/git/controller/opendaylight/archetypes/opendaylight-startup/target/test-classes/projects/basic/project/basic/features/odl-X-api/target/surefire-reports for the individual test results.
Comment by Michael Vorburger [ 27/Nov/17 ]

Debugging this (using -Dmaven.surefire.debug) made me understand that this is caused by Maven -> Surefire -> Pax Exam -> Pax URL not using the custom local repo - it would search for org.opendaylight.odlparent:opendaylight-karaf-empty:zip:2.0.5 in ~/.m2/repository despite -Dmaven.repo.local=.

Setting the org.ops4j.pax.url.mvn.localRepository (or perhaps also org.ops4j.pax.url.mvn.settings, not sure) property somewhere could perhaps fix this...

Comment by Michael Vorburger [ 27/Nov/17 ]

Setting the org.ops4j.pax.url.mvn.localRepository property somewhere...

Adding the following to single-feature-parent/pom.xml seems to fix this problem:

    <systemProperties>
      <property>
        <name>org.ops4j.pax.url.mvn.localRepository</name>
        <value>${settings.localRepository}</value>
      </property>
    </systemProperties>

So proposed in https://git.opendaylight.org/gerrit/#/c/65940/. In addition, it seems to help, if only to make the DL of the BIG Karaf ZIP happen early in the build time instead of by Pax Exam at surefire run time, to add a dependency to opendaylight-karaf-empty, as proposed in https://git.opendaylight.org/gerrit/#/c/65941/.

PS: Ha - I had already done the same in infrautils/itestutils/parent/pom.xml also! (The Patch Set 1 of c/65940 used the deprecated systemProperties instead of the systemPropertyVariables; Patch Set 2 changed that, and has been locally tested to still solve this problem.

Comment by Michael Vorburger [ 22/Jan/18 ]

This came up during https://git.opendaylight.org/gerrit/#/c/66545/ again:

[INFO] Running it.pkg.it.BasicTest
[INFO] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.686 sec <<< FAILURE! - in it.pkg.it.BasicTest
[INFO] it.pkg.it.BasicTest  Time elapsed: 1.662 sec  <<< ERROR!
[INFO] java.lang.RuntimeException: Problem starting container
[INFO] 	at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:191)
(...)
[INFO] Caused by: java.io.IOException: Error resolving artifact org.opendaylight.odlparent:opendaylight-karaf-empty:zip:3.0.2: [Could not find artifact org.opendaylight.odlparent:opendaylight-karaf-empty:zip:3.0.2 in central (https://repo1.maven.org/maven2/)]

and I was able to again as here locally reproduce (see above) and solve it similarly, see https://git.opendaylight.org/gerrit/#/c/66545/3..4/opendaylight/md-sal/mdsal-it-parent/pom.xml. (But that's still NOK due to CONTROLLER-1811; unrelated to this.)

Generated at Wed Feb 07 19:56:29 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.