Search in sources :

Example 11 with StageIdentifier

use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.

the class ShineDaoIntegrationTest method shouldRetriveHistoricalFailureInformation.

@Test
public void shouldRetriveHistoricalFailureInformation() throws Exception {
    Pipeline pipeline1 = pipeline;
    TestFailureSetup.SavedStage savedStage = failureSetup.setupPipelineInstance(true, null, goURLRepository);
    StageIdentifier stageId2 = savedStage.stageId;
    Pipeline pipeline2 = savedStage.pipeline;
    StageTestRuns stageTestRuns = shineDao.failedBuildHistoryForStage(stageId2, result);
    List<FailingTestsInPipeline> failingTestsInPipelines = stageTestRuns.failingTestsInPipelines();
    assertThat(failingTestsInPipelines.size(), is(2));
    FailingTestsInPipeline failingPipeline2 = failingTestsInPipelines.get(0);
    assertThat(failingPipeline2.getLabel(), is(pipeline2.getLabel()));
    assertThat(failingPipeline2.failingSuites().size(), is(0));
    FailingTestsInPipeline failingPipeline1 = failingTestsInPipelines.get(1);
    assertThat(failingPipeline1.getLabel(), is(pipeline1.getLabel()));
    assertThat(failingPipeline1.failingSuites().size(), is(1));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Pipeline(com.thoughtworks.go.domain.Pipeline) FailingTestsInPipeline(com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline) Test(org.junit.Test)

Example 12 with StageIdentifier

use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.

the class ShineDaoIntegrationTest method shouldReturnTheTotalNumberOfFailuresAndErrorsForAPassedStage.

@Test
public void shouldReturnTheTotalNumberOfFailuresAndErrorsForAPassedStage() {
    StageIdentifier stageId = failureSetup.setupPipelineInstance(false, null, Arrays.asList(new Modification("blahUser", "revision 17", "hello@world", new Date(), "17")), new TestFailureSetup.TestResultsStubbing() {

        public void stub(Stage stage) {
            dbHelper.passStage(stage);
            JunitXML junit1 = junitXML("testSuite1", 2).failed(2).errored(1);
            junit1.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(0).getIdentifier().artifactLocator("junit") + "/junit/");
            JunitXML junit2 = junitXML("testSuite1", 2).errored(1);
            junit2.registerStubContent(goURLRepository, "pipelines/" + stage.getJobInstances().get(1).getIdentifier().artifactLocator("junit") + "/junit/");
        }
    }, new Date()).stageId;
    StageTestRuns testRuns = shineDao.failedBuildHistoryForStage(stageId, result);
    assertThat(testRuns.numberOfTests(), is(4));
    assertThat(testRuns.totalErrorCount(), is(2));
    assertThat(testRuns.totalFailureCount(), is(1));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) Modification(com.thoughtworks.go.domain.materials.Modification) StageTestRuns(com.thoughtworks.go.domain.testinfo.StageTestRuns) Stage(com.thoughtworks.go.domain.Stage) JunitXML(com.thoughtworks.studios.shine.cruise.builder.JunitXML) Date(java.util.Date) Test(org.junit.Test)

Example 13 with StageIdentifier

use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.

the class FailedBuildHistoryCacheSweeperTest method shouldClearFbhForPipelinesAfterUpdatedPipeline.

@Test
public void shouldClearFbhForPipelinesAfterUpdatedPipeline() {
    PipelineIdentifier pipelineIdentifier = entryAfterNew.getPipelineLocator();
    Stage stage = StageMother.cancelledStage("dev", "rspec");
    stage.setIdentifier(new StageIdentifier(pipelineIdentifier, "dev", "2"));
    String pipelineKey = key.forFbhOfStagesUnderPipeline(pipelineIdentifier);
    String stageKey = key.forFailedBuildHistoryStage(stage, "html");
    goCache.put(pipelineKey, stageKey, "fragment");
    sweeper.added(newlyAddedEntry, timeline);
    assertThat(goCache.get(pipelineKey), is(nullValue()));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) PipelineIdentifier(com.thoughtworks.go.domain.PipelineIdentifier) Stage(com.thoughtworks.go.domain.Stage) Test(org.junit.Test)

Example 14 with StageIdentifier

use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.

the class StageNotificationServiceTest method setUp.

@Before
public void setUp() {
    pipelineService = mock(PipelineService.class);
    userService = mock(UserService.class);
    systemEnvironment = mock(SystemEnvironment.class);
    stageService = mock(StageService.class);
    inMemoryEmailNotificationTopic = new InMemoryEmailNotificationTopic();
    serverConfigService = mock(ServerConfigService.class);
    goConfigService = mock(GoConfigService.class);
    shineDao = mock(ShineDao.class);
    stageNotificationService = new StageNotificationService(pipelineService, userService, inMemoryEmailNotificationTopic, systemEnvironment, stageService, serverConfigService, shineDao);
    stageIdentifier = new StageIdentifier("go", 1, "go-1", "dev", "2");
    instanceFactory = new InstanceFactory();
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) ShineDao(com.thoughtworks.go.server.dao.sparql.ShineDao) InMemoryEmailNotificationTopic(com.thoughtworks.go.server.messaging.InMemoryEmailNotificationTopic) Before(org.junit.Before)

Example 15 with StageIdentifier

use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.

the class StageFeedEntryTest method shouldNotAddDuplicateMingleCardsToMingleCardsList.

@Test
public void shouldNotAddDuplicateMingleCardsToMingleCardsList() {
    StageFeedEntry entry = new StageFeedEntry(1, 1, new StageIdentifier(), 1, new Date(), StageResult.Passed);
    entry.addCard(new MingleCard(new MingleConfig("mingle-url", "project-name", null), "#1234"));
    entry.addCard(new MingleCard(new MingleConfig("mingle-url", "project-name", null), "#1234"));
    entry.addCard(new MingleCard(new MingleConfig("mingle-url", "project-name-2", null), "#5678"));
    assertThat(entry.getMingleCards().size(), is(2));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) MingleCard(com.thoughtworks.go.server.ui.MingleCard) MingleConfig(com.thoughtworks.go.config.MingleConfig) Date(java.util.Date) Test(org.junit.Test)

Aggregations

StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)59 Test (org.junit.Test)31 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)12 Pipeline (com.thoughtworks.go.domain.Pipeline)12 Stage (com.thoughtworks.go.domain.Stage)12 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)6 StageTestRuns (com.thoughtworks.go.domain.testinfo.StageTestRuns)6 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)6 ArrayList (java.util.ArrayList)6 Modification (com.thoughtworks.go.domain.materials.Modification)5 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)5 Username (com.thoughtworks.go.server.domain.Username)4 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)3 JobInstance (com.thoughtworks.go.domain.JobInstance)3 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)3 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)3 FailingTestsInPipeline (com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline)3 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)3 BoundVariables (com.thoughtworks.studios.shine.semweb.BoundVariables)3 Graph (com.thoughtworks.studios.shine.semweb.Graph)3