Skip to content

Commit

Permalink
Add tests for processReport (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinGroscheTT committed Feb 10, 2025
1 parent 90de842 commit 2d26979
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,29 @@ class ProvideExecutionLogsStepIT extends IntegrationTestBase {
"ignore any download error.", run)
}

def 'Run pipeline with fail missing logs file in .zip'() {
given:
GroovyMock(RestApiClientFactory, global: true)
RestApiClientV2 restApiClientV2Mock = GroovyMock(RestApiClientV2, global: true)
RestApiClientFactory.getRestApiClient(*_) >> restApiClientV2Mock
restApiClientV2Mock.getReport(_) >> new ReportInfo('reportId', 'reportDir', 'result', [])
restApiClientV2Mock.downloadReportFolder(_) >> new File('src/test/resources/report.zip')
and:
GroovyMock(ZipUtil, global: true)
ZipUtil.extractFilesByExtension(*_) >> []
and:
WorkflowJob job = jenkins.createProject(WorkflowJob.class, 'pipeline')
job.setDefinition(new CpsFlowDefinition("node {ttProvideLogs reportIds: ['reportId']}", true))
expect:
WorkflowRun run = jenkins.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0).get())
jenkins.assertLogContains("Providing ecu.test Logs to jenkins.", run)
jenkins.assertLogContains("Providing ecu.test Logs for report reportId...", run)
jenkins.assertLogContains("reportDir is missing one or all log files!", run)
jenkins.assertLogContains("ERROR: Build result set to FAILURE due to missing ecu.test Logs. " +
"Adjust AllowMissing step property if this is not intended.", run)
jenkins.assertLogContains("Providing ecu.test Logs failed!", run)
}

def 'Run pipeline exceeds timeout'() {
int timeout = 1
given:
Expand Down

0 comments on commit 2d26979

Please sign in to comment.