tycho icon indicating copy to clipboard operation
tycho copied to clipboard

Bug: 1275 Support Junit 5.9

Open rimuln opened this issue 2 years ago • 1 comments

  • added provider classes and configuration for new Junit 5.9

Signed-off-by: lnavrat [email protected] Change-Id: I3eff5b3f442a11a60f81b3b2e3386ec6343a7835

rimuln avatar Aug 18 '22 13:08 rimuln

Test Results

324 files  324 suites   2h 3m 41s :stopwatch: 287 tests 283 :heavy_check_mark: 4 :zzz: 0 :x: 574 runs  565 :heavy_check_mark: 9 :zzz: 0 :x:

Results for commit 2228c725.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Aug 18 '22 15:08 github-actions[bot]

OK, but I tried now:

  1. delete the module directories
  2. remove it from org.eclipse.tycho\tycho-surefire\pom.xml
  3. remove dependency from org.eclipse.tycho\tycho-surefire\tycho-surefire-plugin\pom.xml
  4. mvn clean install whole tycho
  5. mvn clean install my project with new tycho => result: [ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:3.0.0-SNAPSHOT:test (default-test) on project de.ids.acos.et.shared.tests: Unable to locate test framework dependency Dependency {groupId=org.eclipse.tycho, artifactId=org.eclipse.tycho.surefire.junit59, version=null, type=jar} [ERROR] Test framework: org.apache.maven.surefire.junitplatform.JUnitPlatformProvider [ERROR] All plugin artifacts: ... [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.osgibooter:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit4:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit47:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit5:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit54:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit55:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit56:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit57:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit57withvintage:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit58:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.junit58withvintage:jar:3.0.0-SNAPSHOT:runtime [ERROR] org.eclipse.tycho:org.eclipse.tycho.surefire.testng:jar:3.0.0-SNAPSHOT:runtime ...

I tried delete in local maven repo org.eclipse tycho. rebuild again and same results.

Next to this it confuse me when older versions always have own module and it isn't needed now. The classes JUnitProvider59 and JUnitProvider59withVintage ofc I have created as C&P of 5.8 and update hint and ranges

rimuln avatar Aug 22 '22 11:08 rimuln

I think the very first step should be to provide an integration-test to demonstrate the issue.

laeubi avatar Aug 22 '22 11:08 laeubi

There shouldn't be such org.eclipse.tycho.surefire.junit59 . Basically, the org.eclipse.tycho.surefire.junit58 should still be used as it's fully compatible with junit 5.9.

mickaelistria avatar Aug 22 '22 11:08 mickaelistria

There shouldn't be such org.eclipse.tycho.surefire.junit59 . Basically, the org.eclipse.tycho.surefire.junit58 should still be used as it's fully compatible with junit 5.9.

So you mean in duplicated class set in @Component hint to junit58 and in getRequiredBundles too?

rimuln avatar Aug 22 '22 11:08 rimuln

No, hint should be junit59, getVersion should return 5.9, but everything else shouldn't be changed (so org.eclipse.tycho.surefire.junit58 is still added in the application).

mickaelistria avatar Aug 22 '22 11:08 mickaelistria

I think the very first step should be to provide an integration-test to demonstrate the issue.

Things are changing during time:). Do you think that C&P of org.eclipse.tycho\tycho-its\projects\surefire.junit56 is good starting point? Because I can't imagine how it should looks in combination with verifier in the mentioned link. (got it extends this file then org.eclipse.tycho\tycho-its\src\test\java\org\eclipse\tycho\test\surefire\JUnit5Test.java)

And could add the ITS directly to this PR or create really new another branch etc? I didn't expect create IT as in past was just extend the provider for new version as was in past. And not all junit5X have IT.

rimuln avatar Aug 22 '22 11:08 rimuln

Whatever suffice here. Without an IT there is no guarantee the feature works in a real run of maven what is what actually counts from my POV...

laeubi avatar Aug 22 '22 12:08 laeubi

@rimuln Have you verified your patch locally? If you've verified it works, we can merge it (even without a test)

mickaelistria avatar Aug 22 '22 14:08 mickaelistria

my project was able to build with it:

[INFO] --- tycho-surefire-plugin:3.0.0-SNAPSHOT:test (default-test) @ de.ids.acos.et.shared.tests ---
[INFO] Could not find a java toolchain of type jdk, using java from JAVA_HOME instead (C:\Java\AdoptOpenJDK\jdk-11.0.16+8\bin\java.exe)
[INFO] Executing Test Runtime with timeout 0, logs (if any) will be placed at: d:\workspaces\hlen-dev\es\client_server\shared\de.ids.acos.et.shared.tests\target\work\data\.metadata\.log
[INFO] Command line:
        [C:\Java\AdoptOpenJDK\jdk-11.0.16+8\bin\java.exe, -Dosgi.noShutdown=false, -Dosgi.os=win32, -Dosgi.ws=win32, -Dosgi.arch=x86_64, -Dosgi.clean=true, -jar, D:\workspaces\hlen-dev\et_commons\build-time\target-platform\de.ids.acos.et.commons.target.preparation.repository\target\repository\plugins\org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar, -data, d:\workspaces\hlen-dev\es\client_server\shared\de.ids.acos.et.shared.tests\target\work\data, -install, d:\workspaces\hlen-dev\es\client_server\shared\de.ids.acos.et.shared.tests\target\work, -configuration, d:\workspaces\hlen-dev\es\client_server\shared\de.ids.acos.et.shared.tests\target\work\configuration, -application, org.eclipse.tycho.surefire.osgibooter.headlesstest, -testproperties, d:\workspaces\hlen-dev\es\client_server\shared\de.ids.acos.et.shared.tests\target\surefire.properties]

Running null
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.118 s - in null
...
Results:
Tests run: 2631, Failures: 0, Errors: 0, Skipped: 0
[INFO] All tests passed!

I tried duplicate and update the the IT test from 56 but run failed on:

[INFO] Adding repository https://download.eclipse.org/releases/2022-06
[DEBUG] [e6649ec0-3462-49c5-a3c8-137e510bb5c6][extension>org.eclipse.tycho:tycho-maven-plugin:3.0.0-SNAPSHOT] Searching bundle for class class org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository and location file:/D:/ide/maven_repo/m3/org/eclipse/platform/org.eclipse.equinox.p2.metadata.repository/1.4.100/org.eclipse.equinox.p2.metadata.repository-1.4.100.jar
[DEBUG] [e6649ec0-3462-49c5-a3c8-137e510bb5c6][extension>org.eclipse.tycho:tycho-maven-plugin:3.0.0-SNAPSHOT] Return bundle org.eclipse.equinox.p2.metadata.repository for location file:/D:/ide/maven_repo/m3/org/eclipse/platform/org.eclipse.equinox.p2.metadata.repository/1.4.100/org.eclipse.equinox.p2.metadata.repository-1.4.100.jar
[INFO] [main] Resolving dependencies of MavenProject: org.eclipse.tycho.tycho-its.surefire-junit5:bundle.test.junit59:1.0.0 @ d:\ide\eclipse\tycho-master\git\org.eclipse.tycho\tycho-its\target\projects\JUnit5Test\testJUnit59Runner\surefire.junit59\bundle.test\pom.xml
[DEBUG] No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from bundle.test.junit59 1.0.0 to java.package; org.junit.jupiter.api 5.9.0.; No solution found because the problem is unsatisfiable.]
[INFO] {osgi.os=win32, osgi.ws=win32, org.eclipse.update.install.features=true, osgi.arch=x86_64}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: bundle.test.junit59 1.0.0
[ERROR]   Missing requirement: bundle.test.junit59 1.0.0 requires 'java.package; org.junit.jupiter.api 5.9.0' but it could not be found
[ERROR]
[ERROR] See https://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[ERROR] Cannot resolve dependencies of MavenProject: org.eclipse.tycho.tycho-its.surefire-junit5:bundle.test.junit59:1.0.0 @ d:\ide\eclipse\tycho-master\git\org.eclipse.tycho\tycho-its\target\projects\JUnit5Test\testJUnit59Runner\surefire.junit59\bundle.test\pom.xml: See log for details -> [Help 1]
org.apache.maven.MavenExecutionException: Cannot resolve dependencies of MavenProject: org.eclipse.tycho.tycho-its.surefire-junit5:bundle.test.junit59:1.0.0 @ d:\ide\eclipse\tycho-master\git\org.eclipse.tycho\tycho-its\target\projects\JUnit5Test\testJUnit59Runner\surefire.junit59\bundle.test\pom.xml
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead (TychoMavenLifecycleParticipant.java:184)

But I don't know how add junit 5.9.0 to ITs target platform. any hint or I don't care about it? For our project we create own p2 "wrapper" repo generated from maven and to TP add it from our internal site.

In pom.xml of tycho-its I saw dependency for junit 5.9.0 aggregator but it seems that it isnt used for TP?

What is strange for me and don't know where is problem if in tycho surefire or junit is missing test name see in first snippet

Running null and on next line in null

rimuln avatar Aug 22 '22 16:08 rimuln

JUnit 5.9 can be found in Eclipse Platform I-Build repository: https://download.eclipse.org/eclipse/updates/4.25-I-builds/ , but this repo is not persisted and will vanish soon, so the test that uses it will soon be failing. However, it's worth adding the test anyway and we'll adapt to a stable URL when Platform releases 4.25. Would that be OK with you?

mickaelistria avatar Aug 22 '22 16:08 mickaelistria

Thank you!

mickaelistria avatar Aug 23 '22 10:08 mickaelistria