use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.
the class ShineDao method failedBuildHistoryForStage.
public StageTestRuns failedBuildHistoryForStage(StageIdentifier stageId, LocalizedOperationResult result) {
try {
StageTestRuns stageTestRuns = getTestCount(stageId);
List<StageIdentifier> failedStageIds = stageService.findRunForStage(stageId);
populateFailingTests(stageTestRuns, getFailedTests(failedStageIds));
populateUsers(stageTestRuns, getCommitters(failedStageIds));
stageTestRuns.removeDuplicateTestEntries();
return stageTestRuns;
} catch (RuntimeException e) {
LOGGER.error("can not retrieve shine test history!", e);
result.connectionError(LocalizedMessage.unableToRetrieveFailureResults());
return new StageTestRuns(0, 0, 0);
}
}
use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.
the class ShineDaoIntegrationTest method shouldContainLocatorForFailedJob.
@Test
public void shouldContainLocatorForFailedJob() throws Exception {
StageTestRuns stageTestRuns = failingStageHistory();
List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
FailingTestsInPipeline failingPipeline7 = failingTestsInPipelines.get(0);
FailingTestsInPipeline failingPipeline6 = failingTestsInPipelines.get(1);
List<TestInformation> failingTests7 = failingPipeline7.failingSuites().get(0).tests();
assertThat(failingTests7.size(), is(1));
assertThat(failingTests7.get(0).getJobs().size(), is(2));
assertThat(failingTests7.get(0).getJobs().get(0).getBuildName(), is("NixBuild"));
assertThat(failingTests7.get(0).getJobs().get(0).buildLocator(), is("foo-pipeline/3/bar-stage/1/NixBuild"));
assertThat(failingTests7.get(0).getJobs().get(1).buildLocator(), is("foo-pipeline/3/bar-stage/1/WinBuild"));
List<TestInformation> failingTests6 = failingPipeline6.failingSuites().get(0).tests();
assertThat(failingTests6.size(), is(2));
assertThat(failingTests6.get(0).getJobs().size(), is(1));
assertThat(failingTests6.get(0).getJobs().get(0).getBuildName(), is("WinBuild"));
assertThat(failingTests6.get(0).getJobs().get(0).buildLocator(), is("foo-pipeline/2/bar-stage/1/WinBuild"));
assertThat(failingTests6.get(1).getJobs().size(), is(1));
assertThat(failingTests6.get(1).getJobs().get(0).getBuildName(), is("WinBuild"));
assertThat(failingTests6.get(1).getJobs().get(0).buildLocator(), is("foo-pipeline/2/bar-stage/1/WinBuild"));
}
use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.
the class ShineDaoIntegrationTest method shouldRetriveHistoricalFailureWithNoTests.
@Test
public void shouldRetriveHistoricalFailureWithNoTests() throws Exception {
failureSetup.setupPipelineInstance(true, null, goURLRepository);
StageIdentifier stageId3 = failureSetup.setupPipelineInstance(true, null, goURLRepository).stageId;
StageTestRuns stageTestRuns = shineDao.failedBuildHistoryForStage(stageId3, result);
List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
assertThat(failingTestsInPipelines.size(), is(3));
}
use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.
the class ShineDaoIntegrationTest method shouldPopulateUsersThatTriggeredTheBuild.
@Test
public void shouldPopulateUsersThatTriggeredTheBuild() {
StageTestRuns stageTestRuns = failingStageHistory();
List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
List<String> users = failingTestsInPipelines.get(1).users();
assertThat(users.size(), is(2));
assertThat(users, hasItem("fooUser"));
assertThat(users, hasItem("RRR & DR"));
assertThat(users.size(), is(2));
users = failingTestsInPipelines.get(0).users();
assertThat(users.size(), is(1));
assertThat(users, hasItem("blahUser"));
}
use of com.thoughtworks.go.domain.testinfo.StageTestRuns in project gocd by gocd.
the class ShineDaoIntegrationTest method shouldBeAbleToRetriveStageTestRunsWithLazyGraphLoader.
@Test
public void shouldBeAbleToRetriveStageTestRunsWithLazyGraphLoader() throws Exception {
StageTestRuns stageTestRuns = shineDao.failedBuildHistoryForStage(stageId, result);
List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
assertThat(failingTestsInPipelines.toString(), failingTestsInPipelines.size(), is(1));
List<TestSuite> suites = failingTestsInPipelines.get(0).failingSuites();
assertThat(suites.size(), is(1));
assertThat(suites.get(0).fullName(), is("testSuite1"));
List<TestInformation> tests = suites.get(0).tests();
assertThat(tests.size(), is(2));
assertThat(tests.get(0).getName(), is("test1"));
assertThat(tests.get(0).getStatus(), is(TestStatus.Failure));
assertThat(tests.get(0).getJobNames(), hasItems("NixBuild", "WinBuild"));
assertThat(tests.get(1).getName(), is("test2"));
assertThat(tests.get(1).getStatus(), is(TestStatus.Error));
assertThat(tests.get(1).getJobNames(), hasItems("WinBuild"));
}
Aggregations