use of com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner in project synopsys-detect by blackducksoftware.
the class DetectOnDetectTest method detectOnDetect.
@Test
void detectOnDetect() throws IOException, IntegrationException {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-on-detect", "detect-7.1.0:1.0.0")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Detect-7.1.0.dockerfile"));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
BlackDuckAssertions blackduckAssertions = blackDuckTestConnection.projectVersionAssertions("detect-on-detect-docker", "happy-path");
blackduckAssertions.emptyOnBlackDuck();
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(test);
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.projectNameVersion(blackduckAssertions);
commandBuilder.waitForResults();
DockerAssertions dockerAssertions = test.run(commandBuilder);
// 7 code locations, 6 bdio, 1 signature scanner
dockerAssertions.bdioFiles(1);
blackduckAssertions.hasCodeLocations("src/detect-on-detect-docker/happy-path scan");
blackduckAssertions.hasComponents("jackson-core");
}
}
use of com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner in project synopsys-detect by blackducksoftware.
the class DetectOnDetectTest method riskReportResultProduced.
@Test
public // Simply verify a risk report is generated at the expected location.
void riskReportResultProduced() throws Exception {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-on-detect-riskreport-default", "detect-7.1.0:1.0.0")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Detect-7.1.0.dockerfile"));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
BlackDuckAssertions blackDuckAssertions = blackDuckTestConnection.projectVersionAssertions("synopsys-detect-junit", "risk-report-default");
blackDuckAssertions.emptyOnBlackDuck();
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(test);
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.projectNameVersion(blackDuckAssertions.getProjectNameVersion());
commandBuilder.property(DetectProperties.DETECT_RISK_REPORT_PDF, "true");
commandBuilder.property(DetectProperties.DETECT_TIMEOUT, "1200");
commandBuilder.tools(DetectTool.DETECTOR);
DockerAssertions dockerAssertions = test.run(commandBuilder);
dockerAssertions.resultProducedAtLocation("/opt/project/src/synopsys_detect_junit_risk_report_default_BlackDuck_RiskReport.pdf");
}
}
use of com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner in project synopsys-detect by blackducksoftware.
the class RapidModeTests method anyProjectWithRapidResultsInBlackDuck.
SharedDockerTestRunner anyProjectWithRapidResultsInBlackDuck(String testId, NameVersion projectNameVersion) throws IOException, IntegrationException {
try (DetectDockerTestRunner runner = new DetectDockerTestRunner(testId, "gradle-simple:1.0.0")) {
runner.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("SimpleGradle.dockerfile"));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
BlackDuckAssertions blackduckAssertions = blackDuckTestConnection.projectVersionAssertions(projectNameVersion);
blackduckAssertions.emptyOnBlackDuck();
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(runner);
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.projectNameVersion(blackduckAssertions);
// All that is needed for a BOM in black duck.
commandBuilder.tools(DetectTool.DETECTOR);
return new SharedDockerTestRunner(runner, blackDuckTestConnection, blackduckAssertions, commandBuilder);
}
}
use of com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner in project synopsys-detect by blackducksoftware.
the class SubProjectAggregateModeTest method subProjectAggregateModeSmokeTest.
// Once we're testing against Black Duck 2021.10+, we can verify that the correct project name/version
// was created in Black Duck. But that doesn't work yet (in Black Duck).
@Test
void subProjectAggregateModeSmokeTest() throws IOException, IntegrationException {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("subproject-aggregate-mode", "detect-7.1.0:1.0.0")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("Detect-7.1.0.dockerfile"));
BlackDuckTestConnection blackDuckTestConnection = BlackDuckTestConnection.fromEnvironment();
BlackDuckAssertions blackduckAssertions = blackDuckTestConnection.projectVersionAssertions("subproject-aggregate-mode-docker", "happy-path");
blackduckAssertions.emptyOnBlackDuck();
DetectCommandBuilder commandBuilder = new DetectCommandBuilder().defaults().defaultDirectories(test);
commandBuilder.connectToBlackDuck(blackDuckTestConnection);
commandBuilder.projectNameVersion(blackduckAssertions);
String bdioFilename = "testagg";
commandBuilder.property("detect.bdio.file.name", bdioFilename);
commandBuilder.property("detect.tools", "DETECTOR");
DockerAssertions dockerAssertions = test.run(commandBuilder);
dockerAssertions.successfulOperation("SubProject Aggregate");
dockerAssertions.bdioFiles(1);
dockerAssertions.bdioFileCreated(bdioFilename + ".bdio");
}
}
use of com.synopsys.integration.detect.battery.docker.util.DetectDockerTestRunner in project synopsys-detect by blackducksoftware.
the class ArchitectureTest method linuxHasArchitectureLog.
@Test
void linuxHasArchitectureLog() throws IOException {
try (DetectDockerTestRunner test = new DetectDockerTestRunner("detect-architecture", "empty-linux:1.0.0")) {
test.withImageProvider(BuildDockerImageProvider.forDockerfilResourceNamed("EmptyLinux.dockerfile"));
DetectCommandBuilder commandBuilder = DetectCommandBuilder.withOfflineDefaults().defaultDirectories(test);
commandBuilder.property(DetectProperties.DETECT_TOOLS, "NONE");
DockerAssertions dockerAssertions = test.run(commandBuilder);
dockerAssertions.logContains("You seem to be using amd64 architecture.");
}
}
Aggregations