use of com.synopsys.integration.detect.battery.docker.util.DockerAssertions 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.DockerAssertions 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.DockerAssertions in project synopsys-detect by blackducksoftware.
the class RapidModeTests method rapidModeSmokeTest.
@Test
void rapidModeSmokeTest() throws IOException, IntegrationException {
SharedDockerTestRunner test = anyProjectWithRapidResultsInBlackDuck("rapid-mode-smoke-test", new NameVersion("rapid-mode", "smoke-test"));
// Ensuring regardless of the source or working directory being chosen, this test still produces a risk report in the same location.
test.command.property(DetectProperties.DETECT_BLACKDUCK_SCAN_MODE, "RAPID");
DockerAssertions dockerAssertions = test.run();
dockerAssertions.logContains("Critical and blocking policy violations for");
dockerAssertions.logContains("* Components: 0");
dockerAssertions.successfulOperation("Generate Rapid Json File");
}
use of com.synopsys.integration.detect.battery.docker.util.DockerAssertions in project synopsys-detect by blackducksoftware.
the class RiskReportTests method riskReportNotCreatedInWorkingDir.
@Test
void riskReportNotCreatedInWorkingDir() throws IOException, InterruptedException, IntegrationException {
SharedDockerTestRunner test = anyProjectWithRiskReportResultsInBlackDuck("risk-report-does-not-use-working-directory", new NameVersion("risk-reports", "default-not-working-directory"));
test.runner.withWorkingDirectory("/opt/random");
test.command.property(DetectProperties.DETECT_SOURCE_PATH, "/opt/project/src");
test.command.property(DetectProperties.DETECT_RISK_REPORT_PDF, "true");
DockerAssertions dockerAssertions = test.run();
dockerAssertions.resultProducedAtLocation("/opt/project/src/risk_reports_default_not_working_directory_BlackDuck_RiskReport.pdf");
}
use of com.synopsys.integration.detect.battery.docker.util.DockerAssertions in project synopsys-detect by blackducksoftware.
the class RiskReportTests method riskReportSmokeTest.
@Test
void riskReportSmokeTest() throws IOException, InterruptedException, IntegrationException {
SharedDockerTestRunner test = anyProjectWithRiskReportResultsInBlackDuck("risk-report-smoke-test", new NameVersion("risk-reports", "smoke-test"));
// Ensuring regardless of the source or working directory being chosen, this test still produces a risk report in the same location.
test.runner.withWorkingDirectory("/opt/project/src");
test.command.property(DetectProperties.DETECT_SOURCE_PATH, "/opt/project/src");
test.command.property(DetectProperties.DETECT_RISK_REPORT_PDF, "true");
DockerAssertions dockerAssertions = test.run();
dockerAssertions.resultProducedAtLocation("/opt/project/src/risk_reports_smoke_test_BlackDuck_RiskReport.pdf");
}
Aggregations