Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-48945] Testreport lacks of those test in which the hashcode …
…of two different testsuite name coincide Use UUID instead the hashcode of the file to generate a unique converted test report. By default java provides a version 4 UUID that ensure be unique in the same JVM instance. Since there are no more JVM that works with the same workspace is enough. A version 1 UUID that use MAC address to ensure file is unique over Jenkins nodes is not needed since XUnitProcessor does not copy slave node report files back to master.
- Loading branch information
Showing
6 changed files
with
111 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/test/java/org/jenkinsci/plugins/xunit/service/XUnitConversionServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.jenkinsci.plugins.xunit.service; | ||
|
||
import static org.mockito.Mockito.*; | ||
|
||
import java.io.File; | ||
|
||
import org.jenkinsci.plugins.xunit.types.JUnitInputMetric; | ||
import org.junit.Assert; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.jvnet.hudson.test.Issue; | ||
|
||
public class XUnitConversionServiceTest { | ||
|
||
@Rule | ||
public TemporaryFolder folder = new TemporaryFolder(); | ||
|
||
@Issue("JENKINS-48945") | ||
@Test | ||
public void verify_that_report_file_name_does_clashes() throws Exception { | ||
File destFolder = folder.newFolder(); | ||
File inputFile = folder.newFile("com.acme.EKOM02XTest"); | ||
|
||
XUnitToolInfo toolInfo = mock(XUnitToolInfo.class); | ||
when(toolInfo.getInputMetric()).thenReturn(new JUnitInputMetric()); | ||
|
||
XUnitConversionService service = new XUnitConversionService(); | ||
File reportFile = service.convert(toolInfo, inputFile, destFolder); | ||
File reportFile2 = service.convert(toolInfo, inputFile, destFolder); | ||
Assert.assertNotEquals(reportFile.getAbsolutePath(), reportFile2.getAbsolutePath()); | ||
} | ||
} |
Oops, something went wrong.