Search in sources :

Example 76 with JobIdentifier

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

the class JobResultListenerTest method setup.

@Before
public void setup() {
    agentService = mockery.mock(AgentService.class);
    listener = new JobResultListener(new JobResultTopic(null), agentService);
    jobIdentifier = new JobIdentifier("cruise", "1", "dev", "1", "linux-firefox");
}
Also used : AgentService(com.thoughtworks.go.server.service.AgentService) JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Before(org.junit.Before)

Example 77 with JobIdentifier

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

the class FailingTestsInPipelineTest method shouldRemoveSuiteIfNoTestsAfterDuplicateRemoval.

@Test
public void shouldRemoveSuiteIfNoTestsAfterDuplicateRemoval() {
    failingTests.add("suiteA", "testA", TestStatus.Error, new JobIdentifier("", 3, "", "", "", "job-1"));
    failingTests.add("suiteB", "testB", TestStatus.Error, new JobIdentifier("", 3, "", "", "", "job-1"));
    FailingTestsInPipeline failingTests1 = new FailingTestsInPipeline("1.3", 3);
    failingTests1.add("suiteA", "testA", TestStatus.Error, new JobIdentifier("", 4, "", "", "", "job-1"));
    failingTests.removeDuplicateTestEntries(failingTests1);
    List<TestSuite> failingSuites = failingTests.failingSuites();
    assertThat(failingSuites.size(), is(1));
    assertThat(failingSuites.get(0).fullName(), is("suiteB"));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 78 with JobIdentifier

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

the class StageTestRunsTest method removeDuplicateTestEntriesDoesNotEliminatesSusequentDuplicateFailuresWhenJobsAreNotIdentical.

@Test
public void removeDuplicateTestEntriesDoesNotEliminatesSusequentDuplicateFailuresWhenJobsAreNotIdentical() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 0, 0);
    JobIdentifier job1 = new JobIdentifier(null, 1, null, null, null, "job1");
    JobIdentifier job2 = new JobIdentifier(null, 1, null, null, null, "job2");
    stageTestRuns.add(18, "1.8", "testSuite1", "testName1", TestStatus.Failure, job1);
    stageTestRuns.add(18, "1.8", "testSuite1", "testName1", TestStatus.Failure, job2);
    stageTestRuns.add(17, "1.7", "testSuite1", "testName1", TestStatus.Failure, job2);
    stageTestRuns.add(16, "1.6", "testSuite1", "testName1", TestStatus.Failure, job1);
    stageTestRuns.removeDuplicateTestEntries();
    FailingTestsInPipeline pipeline8 = stageTestRuns.failingTestsInPipelines().get(0);
    FailingTestsInPipeline pipeline7 = stageTestRuns.failingTestsInPipelines().get(1);
    FailingTestsInPipeline pipeline6 = stageTestRuns.failingTestsInPipelines().get(2);
    assertThat(pipeline8.failingSuites().size(), is(1));
    assertThat(pipeline8.failingSuites().get(0).tests().get(0).getJobNames().size(), is(2));
    assertThat(pipeline8.failingSuites().get(0).tests().get(0).getJobNames().get(0), is("job1"));
    assertThat(pipeline8.failingSuites().get(0).tests().get(0).getJobNames().get(1), is("job2"));
    assertThat(pipeline7.failingSuites().size(), is(1));
    assertThat(pipeline7.failingSuites().get(0).tests().get(0).getJobNames().size(), is(1));
    assertThat(pipeline7.failingSuites().get(0).tests().get(0).getJobNames().get(0), is("job2"));
    assertThat(pipeline6.failingSuites().size(), is(1));
    assertThat(pipeline6.failingSuites().get(0).tests().get(0).getJobNames().size(), is(1));
    assertThat(pipeline6.failingSuites().get(0).tests().get(0).getJobNames().get(0), is("job1"));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 79 with JobIdentifier

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

the class StageTestRunsTest method removeDuplicateTestEntriesEliminatesSusequentDuplicateFailures.

@Test
public void removeDuplicateTestEntriesEliminatesSusequentDuplicateFailures() throws Exception {
    StageTestRuns stageTestRuns = new StageTestRuns(999, 0, 0);
    JobIdentifier jobIdentifier = new JobIdentifier(null, 1, null, null, null, "job1");
    stageTestRuns.add(18, "1.8", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(17, "1.7", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.add(16, "1.6", "testSuite1", "testName1", TestStatus.Failure, jobIdentifier);
    stageTestRuns.removeDuplicateTestEntries();
    assertThat(stageTestRuns.failingTestsInPipelines().size(), is(3));
    FailingTestsInPipeline pipeline8 = stageTestRuns.failingTestsInPipelines().get(0);
    FailingTestsInPipeline pipeline7 = stageTestRuns.failingTestsInPipelines().get(1);
    FailingTestsInPipeline pipeline6 = stageTestRuns.failingTestsInPipelines().get(2);
    assertThat(pipeline8.failingSuites().size(), is(0));
    assertThat(pipeline7.failingSuites().size(), is(0));
    assertThat(pipeline6.failingSuites().size(), is(1));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Example 80 with JobIdentifier

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

the class TestInformationTest method equalsFalseWhenStatusSameNameSameAndJobIdentifiersHaveDifferentNames.

@Test
public void equalsFalseWhenStatusSameNameSameAndJobIdentifiersHaveDifferentNames() {
    TestInformation testInformation1 = new TestInformation("testA", TestStatus.Error);
    testInformation1.addJob(new JobIdentifier("", -1, "", "", "", "job-1"));
    TestInformation testInformation2 = new TestInformation("testA", TestStatus.Error);
    testInformation2.addJob(new JobIdentifier("", -1, "", "", "", "job-2"));
    assertThat(testInformation1, not(testInformation2));
    assertThat(testInformation2, not(testInformation1));
    assertThat(Arrays.asList(testInformation1), not(hasItem(testInformation2)));
}
Also used : JobIdentifier(com.thoughtworks.go.domain.JobIdentifier) Test(org.junit.Test)

Aggregations

JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)113 Test (org.junit.Test)85 File (java.io.File)16 JobInstance (com.thoughtworks.go.domain.JobInstance)15 Pipeline (com.thoughtworks.go.domain.Pipeline)13 DateTime (org.joda.time.DateTime)12 Before (org.junit.Before)10 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)7 Stage (com.thoughtworks.go.domain.Stage)6 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)5 IllegalArtifactLocationException (com.thoughtworks.go.domain.exception.IllegalArtifactLocationException)5 AgentMetadata (com.thoughtworks.go.plugin.access.elastic.models.AgentMetadata)5 IOException (java.io.IOException)5 ModelAndView (org.springframework.web.servlet.ModelAndView)5 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)3 Property (com.thoughtworks.go.domain.Property)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 RunIf (com.googlecode.junit.ext.RunIf)2 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)2 HeaderConstraint (com.thoughtworks.go.server.security.HeaderConstraint)2