Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<!-- Test Library Dependencies Versions -->
<xmlunit.version>2.11.0</xmlunit.version>
<testcontainers.version>1.21.4</testcontainers.version>
<testcontainers.version>2.0.4</testcontainers.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -194,18 +194,6 @@
<artifactId>testcontainers</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>

<!-- Test Plugin Dependencies -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package io.jenkins.plugins.coverage.metrics.source;

import org.junit.jupiter.api.Disabled;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.MountableFile;

import java.io.IOException;
Expand All @@ -11,19 +9,17 @@
import hudson.model.Node;

/**
* Verifies if source code copying and rendering works on Docker agents.
* Verifies if source code copying and rendering work on Docker agents.
*
* @author Ullrich Hafner
*/
@Testcontainers(disabledWithoutDocker = true)
@Disabled("Docker tests are failing with Java 17 Jenkins")
class DockerAgentSourceCodeITest extends SourceCodeITest {
private static final String SOURCES_IN_DOCKER_PATH = "/tmp/coverage";
private static final String ACU_COBOL_PARSER_CONTAINER_PATH = SOURCES_IN_DOCKER_PATH + "/" + ACU_COBOL_PARSER_PACKAGE_PATH + ACU_COBOL_PARSER_FILE_NAME;
private static final String PATH_UTIL_CONTAINER_PATH = SOURCES_IN_DOCKER_PATH + "/" + PATH_UTIL_PACKAGE_PATH + PATH_UTIL_FILE_NAME;

private static final String RESOURCES = "io/jenkins/plugins/coverage/metrics/source/";
@Container
private static final AgentContainer AGENT_CONTAINER = new AgentContainer()
.withCopyFileToContainer(
MountableFile.forClasspathResource(RESOURCES + ACU_COBOL_PARSER_SOURCE_FILE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

import edu.hm.hafner.coverage.Coverage;
import edu.hm.hafner.coverage.Difference;
Expand Down Expand Up @@ -44,7 +42,6 @@
* @author Florian Orendi
*/
@Disabled("Docker tests are failing with Java 17 Jenkins")
@Testcontainers(disabledWithoutDocker = true)
class GitForensicsITest extends AbstractCoverageITest {
/** The JaCoCo coverage report, generated for the commit {@link #COMMIT}. */
private static final String JACOCO_FILE = "forensics_integration.xml";
Expand All @@ -56,7 +53,6 @@ class GitForensicsITest extends AbstractCoverageITest {

private static final String REPOSITORY = "https://github.com/jenkinsci/forensics-api-plugin.git";

@Container
private static final AgentContainer AGENT_CONTAINER = new AgentContainer();

@ParameterizedTest(name = "Source code retention {0} should store {1} files")
Expand Down Expand Up @@ -116,8 +112,10 @@ void shouldVerifyQualityGate(final Baseline baseline, final double threshold, fi
verifyGitRepositoryForCommit(referenceBuild, COMMIT_REFERENCE);

String qualityGate = String.format(", qualityGates: ["
+ " [threshold: %f, metric: 'LINE', baseline: '%s', criticality: 'UNSTABLE']]", threshold, baseline.name());
project.setDefinition(createPipelineForCommit(node, COMMIT, JACOCO_FILE, SourceCodeRetention.EVERY_BUILD, qualityGate));
+ " [threshold: %f, metric: 'LINE', baseline: '%s', criticality: 'UNSTABLE']]", threshold,
baseline.name());
project.setDefinition(
createPipelineForCommit(node, COMMIT, JACOCO_FILE, SourceCodeRetention.EVERY_BUILD, qualityGate));
Run<?, ?> build = buildWithResult(project, Result.UNSTABLE);

verifyCoverage(build.getAction(CoverageBuildAction.class), referenceBuild.getAction(CoverageBuildAction.class));
Expand All @@ -127,10 +125,12 @@ void shouldVerifyQualityGate(final Baseline baseline, final double threshold, fi
if (baseline == Baseline.PROJECT_DELTA
|| baseline == Baseline.MODIFIED_FILES_DELTA
|| baseline == Baseline.MODIFIED_LINES_DELTA) {
assertThat(getConsoleLog(build)).contains("≪Unstable≫ - (Actual value: %+.2f%%, Quality gate: %.2f)".formatted(value, threshold));
assertThat(getConsoleLog(build)).contains(
"≪Unstable≫ - (Actual value: %+.2f%%, Quality gate: %.2f)".formatted(value, threshold));
}
else {
assertThat(getConsoleLog(build)).contains("≪Unstable≫ - (Actual value: %.2f%%, Quality gate: %.2f)".formatted(value, threshold));
assertThat(getConsoleLog(build)).contains(
"≪Unstable≫ - (Actual value: %.2f%%, Quality gate: %.2f)".formatted(value, threshold));
}
}

Expand Down
Loading