Skip to content

Conversation

strangelookingnerd
Copy link
Contributor

This PR aims to migrate all tests to JUnit5. Changes include:

  • Migrate annotations and imports
  • Migrate assertions
  • Remove public visibility for test classes and methods
  • Minor clean up

I am well aware that this is a quite large changeset however I hope that there is still interest in this PR and it will be reviewed.
If there are any questions, please do not hesitate to ping me.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@strangelookingnerd strangelookingnerd requested a review from a team as a code owner October 8, 2025 14:30
@github-actions github-actions bot added dependencies Dependency related change tests Automated test addition or improvement labels Oct 8, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously it was not possible to have more than one GitSampleRepoRule per test when using this extension.
As there are several examples of that being required in tests, I added it here.

I already noticed this requirement in some other plugins that could also benefit from this enhancement.

@MarkEWaite MarkEWaite removed the dependencies Dependency related change label Oct 8, 2025
@strangelookingnerd
Copy link
Contributor Author

Even though the changeset is already huge, there is still plenty more room for improvements in code quality.
If there is interest I'd be happy to give the test classes some polishing 👍🏼

* Migrate annotations and imports
* Migrate assertions
* Remove public visibility for test classes and methods
* Minor code cleanup
@github-actions github-actions bot added the dependencies Dependency related change label Oct 8, 2025
@MarkEWaite
Copy link
Contributor

If there is interest I'd be happy to give the test classes some polishing 👍🏼

There is definitely interest! Improvements to the test classes would be much appreciated.

Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test suite in the git plugin is used by other plugins. They consume the GitSampleRepoRule (as one example). As far as I can tell, this change will break those consumers.

Can the plugin still provide the GitSampleRepoRule and other dependencies that are needed for plugins that use it like these?

@strangelookingnerd
Copy link
Contributor Author

The test suite in the git plugin is used by other plugins. They consume the GitSampleRepoRule (as one example). As far as I can tell, this change will break those consumers.

What change exactly? I don't think there is any breaking change hidden.

Can the plugin still provide the GitSampleRepoRule and other dependencies that are needed for plugins that use it like these?

Since I did not remove the GitSampleRepoRule or change it in an incompatible way I would not see why not. My change to the GitSampleRepoExtension is also not problematic for consumers, quite the opposite should be the case.

I am unaware of other classes that may be used by consumers e.g. as base classes for their tests. However I'd be willing to fix them in case we find any.

@MarkEWaite
Copy link
Contributor

However I'd be willing to fix them in case we find any.

Thanks very much for your willingness! When I apply the following patch to the copyartifact plugin it fails the LegacyJobConfigMigrationMonitorMigrationTest:

diff --git a/pom.xml b/pom.xml
index 7c51099..09f60fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
         <revision>1.49</revision>
         <changelist>999999-SNAPSHOT</changelist>
         <gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
-        <jenkins.baseline>2.479</jenkins.baseline>
+        <jenkins.baseline>2.504</jenkins.baseline>
         <jenkins.version>${jenkins.baseline}.3</jenkins.version>
         <useBeta>true</useBeta>
         <spotbugs.effort>Max</spotbugs.effort>
@@ -143,6 +143,7 @@
       <dependency>
         <groupId>org.jenkins-ci.plugins</groupId>
         <artifactId>git</artifactId>
+        <version>5.8.1-rc5487.177b_645258b_e</version>
         <scope>test</scope>
       </dependency>
       <dependency>
@@ -150,6 +151,7 @@
         <groupId>org.jenkins-ci.plugins</groupId>
         <artifactId>git</artifactId>
         <classifier>tests</classifier>
+        <version>5.8.1-rc5487.177b_645258b_e</version>
         <scope>test</scope>
       </dependency>
       <dependency>
@@ -165,7 +167,7 @@
         <dependency>
           <groupId>io.jenkins.tools.bom</groupId>
           <artifactId>bom-${jenkins.baseline}.x</artifactId>
-          <version>5054.v620b_5d2b_d5e6</version>
+          <version>5543.vfd758c7c868d</version>
           <scope>import</scope>
           <type>pom</type>
         </dependency>

If I switch the git plugin version from the incremental the version provided by the plugin BOM, then the tests pass.

@strangelookingnerd
Copy link
Contributor Author

I'll look into it and see what change may be causing this 👍

@strangelookingnerd
Copy link
Contributor Author

Seems to be an issue with the JUnit version pulled by the copyartifact plugin vs. the git plugin.

While that should be resolved when using the latest pom / bom for the time being reverting to the deprecated method call should be fine. Fixed in 2dbe72f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Dependency related change tests Automated test addition or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants