Skip to content

Commit

Permalink
Fix reference of old quality gate status.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jan 2, 2024
1 parent 69d72f5 commit 58afecf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import io.jenkins.plugins.analysis.core.model.AnalysisResult;
import io.jenkins.plugins.analysis.core.model.ResultAction;
import io.jenkins.plugins.analysis.core.util.QualityGateStatus;
import io.jenkins.plugins.monitoring.MonitorPortlet;
import io.jenkins.plugins.monitoring.MonitorPortletFactory;
import io.jenkins.plugins.util.QualityGateStatus;

/**
* A portlet that can be used for the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void setUnstable(final boolean unstable) {
setCriticality(QualityGateCriticality.FAILURE);
}
}

/**
* Returns the method that should be used to determine the actual number of issues in the build.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void configureRecorder(final WorkflowJob job, final String fileName) {
+ " echo '[totalSize=' + result.getTotals().getTotalSize() + ']' \n"
+ " echo '[newSize=' + result.getTotals().getNewSize() + ']' \n"
+ " echo '[fixedSize=' + result.getTotals().getFixedSize() + ']' \n"
+ " echo '[qualityGate=' + result.getQualityGateStatus() + ']' \n"
+ " echo '[qualityGate=' + result.getQualityGateResult() + ']' \n"
+ " echo '[id=' + result.getId() + ']' \n"
+ " result.getIssues().each { issue ->\n"
+ " echo issue.toString()\n"
Expand Down Expand Up @@ -194,8 +194,7 @@ void shouldSkipBlaming() {

job.setDefinition(new CpsFlowDefinition("node {\n"
+ " stage ('Integration Test') {\n"
+ " recordIssues forensicsDisabled: true, skipBlames: true, tool: checkStyle(pattern: '**/"
+ "checkstyle1" + "*')\n"
+ " recordIssues skipBlames: true, tool: checkStyle(pattern: '**/checkstyle1" + "*')\n"
+ " }\n"
+ "}", true));
Run<?, ?> baseline = buildSuccessfully(job);
Expand Down Expand Up @@ -573,56 +572,6 @@ void shouldFailBuildWhenFailBuildOnErrorsIsSet() {
scheduleBuildAndAssertStatus(job, Result.FAILURE);
}

/** Runs the JavaDoc parser and enforces quality gates. */
@Test
@org.jvnet.hudson.test.Issue("JENKINS-58253")
void shouldSupportDeprecatedAttributesInRecord() {
WorkflowJob job = createPipelineWithWorkspaceFilesWithSuffix("javadoc.txt");

job.setDefinition(asStage(
"recordIssues tool: javaDoc(pattern:'**/*issues.txt', reportEncoding:'UTF-8'), "
+ "unstableTotalAll: 6"));
buildWithResult(job, Result.UNSTABLE);

job.setDefinition(asStage(
"recordIssues tool: javaDoc(pattern:'**/*issues.txt', reportEncoding:'UTF-8'), "
+ "failedTotalAll: 6"));
buildWithResult(job, Result.FAILURE);

job.setDefinition(asStage(
"recordIssues tool: javaDoc(pattern:'**/*issues.txt', reportEncoding:'UTF-8'), "
+ "unstableTotalNormal: 6"));
buildWithResult(job, Result.UNSTABLE);

job.setDefinition(asStage(
"recordIssues tool: javaDoc(pattern:'**/*issues.txt', reportEncoding:'UTF-8'), "
+ "failedTotalNormal: 6"));
buildWithResult(job, Result.FAILURE);
}

/** Runs the JavaDoc parser and enforces quality gates. */
@Test
@org.jvnet.hudson.test.Issue("JENKINS-58253")
void shouldSupportDeprecatedAttributesInPublish() {
WorkflowJob job = createPipelineWithWorkspaceFilesWithSuffix("javadoc.txt");

job.setDefinition(asStage(createScanForIssuesStep(new JavaDoc(), "java"),
"publishIssues issues:[java], unstableTotalAll: 6"));
buildWithResult(job, Result.UNSTABLE);

job.setDefinition(asStage(createScanForIssuesStep(new JavaDoc(), "java"),
"publishIssues issues:[java], failedTotalAll: 6"));
buildWithResult(job, Result.FAILURE);

job.setDefinition(asStage(createScanForIssuesStep(new JavaDoc(), "java"),
"publishIssues issues:[java], unstableTotalNormal: 6"));
buildWithResult(job, Result.UNSTABLE);

job.setDefinition(asStage(createScanForIssuesStep(new JavaDoc(), "java"),
"publishIssues issues:[java], failedTotalNormal: 6"));
buildWithResult(job, Result.FAILURE);
}

/**
* Runs the all Java parsers on three output files: the build should report issues of all tools. The results should
* be aggregated into a new action with the specified ID. Since no name is given the default name is used.
Expand Down

0 comments on commit 58afecf

Please sign in to comment.