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

jf mvn wrapper alters mvn behavior by not honoring -Dmaven.test.failure.ignore=true #2741

Open
jfsarang opened this issue Oct 28, 2024 · 0 comments
Labels
feature request New feature or request

Comments

@jfsarang
Copy link

Describe the request

JFrog CLI doesn't ignore the failed tests, which led the build became "unstable" and build failed.

Current behavior

When passing "-Dmaven.test.failure.ignore=true" in jf mvn deploy command, some test fail and user is getting these errors:
2024-06-25T21:18:57.7016614Z [ThreadedStreamConsumer] ERROR org.apache.maven.plugin.surefire.SurefirePlugin - Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.763 s <<< FAILURE! - in com.roche.upath.schedulers.unmark.service.impl.CaseUnmarkServiceImplTest 2024-06-25T21:18:57.7027306Z [ThreadedStreamConsumer] ERROR org.apache.maven.plugin.surefire.SurefirePlugin - testUnmarkBookmarkedCase Time elapsed: 1.715 s <<< FAILURE!

This makes the build becomes “unstable”

[main] WARNING org.jfrog.build.extractor.maven.BuildDeploymentHelper - Artifactory Build Info Recorder: unstable build, artifacts will not be deployed...

and leads to
{ "status": "failure", "totals": { "success": 0, "failure": 19 }, "files": [] }
It looked like JFrog CLI would search for the failed tests under target/surefire-reports directory. If there are failed tests, the jars are not published.

Reproduction steps

I cloned the repo https://github.com/jfrog/project-examples/tree/master/maven-examples/maven-example and modified this line in /multi1/src/test/java/artifactory/test/AppTest.java

`public void testApp()
{
    assertTrue( false );
}`

Add to pom.xml:

<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.9</version> <scope>test</scope> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.9.8</version> <scope>test</scope> </dependency> </dependencies> . . . <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>3.2.2</version> <configuration> <includes> <include>AppTest.java</include> </includes> <testFailureIgnore>true</testFailureIgnore> </configuration> </plugin>
Then execute

jf mvn deploy -Dsurefire.skipAfterFailureCount=1 --build-name=test-mvn-deploy --build-number=2.0701 -Dmaven.test.failure.ignore=true
the test is failing

[main] ERROR org.apache.maven.plugin.surefire.SurefirePlugin - Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 . . . { "status": "failure", "totals": { "success": 0, "failure": 9 } }
The only way to overcome is setting -Dartifactory.publish.unstable=true .

Expected behavior

It should ignore all failed tests and complete the build without any failures.

JFrog CLI version

2.52.10.

Operating system type and version

macOS - 14.4.1 - 23E224

JFrog Artifactory version

No response

JFrog Xray version

No response

@jfsarang jfsarang added the feature request New feature or request label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant