mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
add test for default thresholds
This commit is contained in:
parent
e2bd9d54c3
commit
ebedbb01e0
@ -187,21 +187,63 @@ class ChecksPublishResultsTest extends BasePipelineTest {
|
|||||||
assertTrue("ArchivePatterns contains ESLint pattern", !archiveStepPatterns.contains('**/eslint.xml'))
|
assertTrue("ArchivePatterns contains ESLint pattern", !archiveStepPatterns.contains('**/eslint.xml'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testPublishWithDefaultThresholds() throws Exception {
|
||||||
|
stepUnderTest.call(pmd: true)
|
||||||
|
|
||||||
|
assertTrue("AnalysisPublisher options not set",
|
||||||
|
publisherStepOptions['AnalysisPublisher'] != null)
|
||||||
|
assertTrue("PmdPublisher options not set",
|
||||||
|
publisherStepOptions['PmdPublisher'] != null)
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for failedTotalHigh not correct",
|
||||||
|
0, publisherStepOptions['AnalysisPublisher']['failedTotalHigh'])
|
||||||
|
assertEquals("PmdPublisher thresholds configuration for failedTotalHigh not correct",
|
||||||
|
0, publisherStepOptions['PmdPublisher']['failedTotalHigh'])
|
||||||
|
// ensure other values are empty
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for failedTotalNormal is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['failedTotalNormal'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for failedTotalLow is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['failedTotalLow'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for failedTotalAll is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['failedTotalAll'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for unstableTotalHigh not correct",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['unstableTotalHigh'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for unstableTotalNormal is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['unstableTotalNormal'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for unstableTotalLow is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['unstableTotalLow'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for unstableTotalAll is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['unstableTotalAll'])
|
||||||
|
// ensure nothing else is published
|
||||||
|
assertTrue("DryPublisher options not empty", publisherStepOptions['DryPublisher'] == null)
|
||||||
|
assertTrue("FindBugsPublisher options not empty", publisherStepOptions['FindBugsPublisher'] == null)
|
||||||
|
assertTrue("CheckStylePublisher options not empty", publisherStepOptions['CheckStylePublisher'] == null)
|
||||||
|
assertTrue("WarningsPublisher options not empty", publisherStepOptions['WarningsPublisher'] == null)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testPublishWithThresholds() throws Exception {
|
void testPublishWithThresholds() throws Exception {
|
||||||
stepUnderTest.call(aggregation: [thresholds: [fail: [high: 0]]], pmd: true)
|
stepUnderTest.call(aggregation: [thresholds: [fail: [high: 10]]], pmd: true)
|
||||||
|
|
||||||
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
assertTrue("AnalysisPublisher options not set", publisherStepOptions['AnalysisPublisher'] != null)
|
||||||
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
|
assertTrue("PmdPublisher options not set", publisherStepOptions['PmdPublisher'] != null)
|
||||||
assertEquals("AnalysisPublisher thresholds configuration for failedTotalHigh not correct", '0', publisherStepOptions['AnalysisPublisher']['failedTotalHigh'])
|
assertEquals("AnalysisPublisher thresholds configuration for failedTotalHigh not correct",
|
||||||
|
10, publisherStepOptions['AnalysisPublisher']['failedTotalHigh'])
|
||||||
// ensure other values are empty
|
// ensure other values are empty
|
||||||
assertTrue("AnalysisPublisher thresholds configuration for failedTotalNormal is set", publisherStepOptions['AnalysisPublisher']['failedTotalNormal'].isEmpty())
|
assertEquals("AnalysisPublisher thresholds configuration for failedTotalNormal is set",
|
||||||
assertTrue("AnalysisPublisher thresholds configuration for failedTotalLow is set", publisherStepOptions['AnalysisPublisher']['failedTotalLow'].isEmpty())
|
null, publisherStepOptions['AnalysisPublisher']['failedTotalNormal'])
|
||||||
assertTrue("AnalysisPublisher thresholds configuration for failedTotalAll is set", publisherStepOptions['AnalysisPublisher']['failedTotalAll'].isEmpty())
|
assertEquals("AnalysisPublisher thresholds configuration for failedTotalLow is set",
|
||||||
assertTrue("AnalysisPublisher thresholds configuration for unstableTotalHigh not correct", publisherStepOptions['AnalysisPublisher']['unstableTotalHigh'].isEmpty())
|
null, publisherStepOptions['AnalysisPublisher']['failedTotalLow'])
|
||||||
assertTrue("AnalysisPublisher thresholds configuration for unstableTotalNormal is set", publisherStepOptions['AnalysisPublisher']['unstableTotalNormal'].isEmpty())
|
assertEquals("AnalysisPublisher thresholds configuration for failedTotalAll is set",
|
||||||
assertTrue("AnalysisPublisher thresholds configuration for unstableTotalLow is set", publisherStepOptions['AnalysisPublisher']['unstableTotalLow'].isEmpty())
|
null, publisherStepOptions['AnalysisPublisher']['failedTotalAll'])
|
||||||
assertTrue("AnalysisPublisher thresholds configuration for unstableTotalAll is set", publisherStepOptions['AnalysisPublisher']['unstableTotalAll'].isEmpty())
|
assertEquals("AnalysisPublisher thresholds configuration for unstableTotalHigh not correct",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['unstableTotalHigh'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for unstableTotalNormal is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['unstableTotalNormal'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for unstableTotalLow is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['unstableTotalLow'])
|
||||||
|
assertEquals("AnalysisPublisher thresholds configuration for unstableTotalAll is set",
|
||||||
|
null, publisherStepOptions['AnalysisPublisher']['unstableTotalAll'])
|
||||||
// ensure nothing else is published
|
// ensure nothing else is published
|
||||||
assertTrue("DryPublisher options not empty", publisherStepOptions['DryPublisher'] == null)
|
assertTrue("DryPublisher options not empty", publisherStepOptions['DryPublisher'] == null)
|
||||||
assertTrue("FindBugsPublisher options not empty", publisherStepOptions['FindBugsPublisher'] == null)
|
assertTrue("FindBugsPublisher options not empty", publisherStepOptions['FindBugsPublisher'] == null)
|
||||||
|
Loading…
Reference in New Issue
Block a user