Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for PluginModernizer class #731

Open
jonesbusy opened this issue Jan 27, 2025 · 6 comments
Open

Unit tests for PluginModernizer class #731

jonesbusy opened this issue Jan 27, 2025 · 6 comments
Labels
good first issue Good for newcomers tests This PR adds/removes/updates test cases

Comments

@jonesbusy
Copy link
Collaborator

What feature do you want to see added?

This class doesn't have any test.

It's implicitly validaded by integration tests, but it deserve unit test as well

Upstream changes

No response

Are you interested in contributing this feature?

No response

@jonesbusy jonesbusy added good first issue Good for newcomers tests This PR adds/removes/updates test cases labels Jan 27, 2025
@biru-codeastromer
Copy link

Hi Sir @jonesbusy ,
I hope you're doing well. I encountered an issue during the build process in the initial step even before my changes again. When I run the mvn clean install command, it fails due to an unexpected version mismatch in the pom.xml file.

The error logs indicate that the version for the artifact plugin was expected to be 5.5, but it was found to be 5.6. Here’s the specific part of the error log:

--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>org.jenkins-ci.plugins</groupId>
     <artifactId>plugin</artifactId>
-    <version>5.5</version>
+    <version>5.6</version>
     <relativePath />
   </parent>

It seems like this version change is causing the build to fail. Could you please look into this discrepancy? I’ve attached the relevant portion of the pom.xml file that is causing the issue.

Thank you for your time, and I look forward to your feedback.

@biru-codeastromer
Copy link

I also checked my java, maven versions . They are fine too !

@saurabhraghuvanshii
Copy link

yaa tests are failing in system too

@jonesbusy
Copy link
Collaborator Author

Why not bump version until updatecli merge the PR?

We have a contributor that did it on his PR

#673

Don't expect maintainers to give you always the information.

@jonesbusy
Copy link
Collaborator Author

See #733

@biru-codeastromer
Copy link

Why not bump version until updatecli merge the PR?

We have a contributor that did it on his PR

#673

Don't expect maintainers to give you always the information.

Thanks Sir for your quick response, and sorry for any confusion caused earlier!
Will keep in mind moving forward

biru-codeastromer added a commit to biru-codeastromer/plugin-modernizer-tool that referenced this issue Jan 27, 2025
Fixes jenkins-infra#731

Add unit tests for the `PluginModernizer` class.

* Add `PluginModernizerTest` class in `plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizerTest.java`.
* Mock dependencies: `Config`, `MavenInvoker`, `GHService`, `PluginService`, `CacheManager`.
* Test `validate` method to ensure it calls `mavenInvoker.validateMaven`, `mavenInvoker.validateMavenVersion`, and `ghService.connect`.
* Test `listRecipes` method to ensure it logs available recipes.
* Test `isDryRun`, `getGithubOwner`, `getSshPrivateKeyPath`, `getMavenVersion`, `getMavenHome`, `getMavenLocalRepo`, `getCachePath`, `getJavaVersion` methods to ensure they return correct values.
* Test `cleanCache`, `start`, `process`, `collectMetadata`, `compilePlugin`, `verifyPlugin`, `printResults`, `printModifiedFiles` methods to ensure they perform expected actions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers tests This PR adds/removes/updates test cases
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants