use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class ReportTest method encodeAndDecodeAsMessageData.
@Test
public void encodeAndDecodeAsMessageData() throws Exception {
AgentRuntimeInfo info = new AgentRuntimeInfo(new AgentIdentifier("HostName", "ipAddress", "uuid"), AgentRuntimeStatus.Idle, null, null, true);
JobIdentifier jobIdentifier = new JobIdentifier("pipeline", 1, "pipelinelabel", "stagename", "1", "job", 1L);
Report report = new Report(info, jobIdentifier, JobResult.Passed);
assertThat(MessageEncoding.decodeData(MessageEncoding.encodeData(report), Report.class), is(report));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class SleepWork method doWork.
@Override
public void doWork(EnvironmentVariableContext environmentVariableContext, AgentWorkContext agentWorkContext) {
cancelLatch = new CountDownLatch(1);
agentWorkContext.getAgentRuntimeInfo().busy(new AgentBuildingInfo("sleepwork", "sleepwork1"));
boolean canceled = false;
DefaultGoPublisher goPublisher = new DefaultGoPublisher(agentWorkContext.getArtifactsManipulator(), new JobIdentifier(), agentWorkContext.getRepositoryRemote(), agentWorkContext.getAgentRuntimeInfo(), "utf-8");
try {
if (this.sleepInMilliSeconds > 0) {
canceled = cancelLatch.await(this.sleepInMilliSeconds, TimeUnit.MILLISECONDS);
}
String result = canceled ? "done_canceled" : "done";
agentWorkContext.getArtifactsManipulator().setProperty(null, new Property(name + "_result", result));
SystemEnvironment systemEnvironment = new SystemEnvironment();
if (systemEnvironment.isConsoleLogsThroughWebsocketEnabled() && systemEnvironment.isWebsocketsForAgentsEnabled()) {
goPublisher.consumeLine(format("Sleeping for %s milliseconds", this.sleepInMilliSeconds));
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class FailingTestsInPipelineTest method shouldRemoveDuplicate.
@Test
public void shouldRemoveDuplicate() {
failingTests.add("suiteA", "testA", TestStatus.Error, new JobIdentifier("", 3, "", "", "", "job-1"));
failingTests.add("suiteA", "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"));
failingTests1.add("suiteA", "testB", TestStatus.Error, new JobIdentifier("", 4, "", "", "", "job-2"));
failingTests.removeDuplicateTestEntries(failingTests1);
assertThat(failingTests.failingSuites().size(), is(1));
List<TestInformation> tests = failingTests.failingSuites().get(0).tests();
assertThat(tests.size(), is(1));
assertThat(tests.get(0).getName(), is("testB"));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class FailingTestsInPipelineTest method shouldOrderSuitesAlphabetically.
@Test
public void shouldOrderSuitesAlphabetically() throws Exception {
failingTests.add("suiteB", "testA", TestStatus.Error, new JobIdentifier("", -1, "", "", "", "job-1"));
failingTests.add("suiteA", "testA", TestStatus.Error, new JobIdentifier("", -1, "", "", "", "job-1"));
failingTests.add("suiteZ", "testA", TestStatus.Error, new JobIdentifier("", -1, "", "", "", "job-1"));
failingTests.add("suiteD", "testA", TestStatus.Error, new JobIdentifier("", -1, "", "", "", "job-1"));
List<TestSuite> suites = failingTests.failingSuites();
assertThat(suites.size(), is(4));
assertThat(suites.get(0).fullName(), is("suiteA"));
assertThat(suites.get(1).fullName(), is("suiteB"));
assertThat(suites.get(2).fullName(), is("suiteD"));
assertThat(suites.get(3).fullName(), is("suiteZ"));
}
use of com.thoughtworks.go.domain.JobIdentifier in project gocd by gocd.
the class StageTestRunsTest method removeDuplicateTestEntriesFromNonAdjacentRuns.
@Test
public void removeDuplicateTestEntriesFromNonAdjacentRuns() throws Exception {
StageTestRuns stageTestRuns = new StageTestRuns(999, 0, 0);
JobIdentifier jobIdentifier = new JobIdentifier(null, 1, null, null, null, "job1");
stageTestRuns.add(10, "1.0", "suite1", "test1-2", TestStatus.Failure, jobIdentifier);
stageTestRuns.add(10, "1.0", "suite1", "test1-1", TestStatus.Error, jobIdentifier);
stageTestRuns.add(11, "1.1", "suite1", "test1-1", TestStatus.Error, jobIdentifier);
stageTestRuns.add(9, "0.9", "suite1", "test1-2", TestStatus.Failure, jobIdentifier);
stageTestRuns.removeDuplicateTestEntries();
FailingTestsInPipeline pipeline10 = stageTestRuns.failingTestsInPipelines().get(0);
FailingTestsInPipeline pipeline11 = stageTestRuns.failingTestsInPipelines().get(1);
FailingTestsInPipeline pipeline09 = stageTestRuns.failingTestsInPipelines().get(2);
assertThat(pipeline10.failingSuites().size(), is(1));
assertThat(pipeline10.failingSuites().get(0).tests().size(), is(1));
assertThat(pipeline11.failingSuites().size(), is(1));
assertThat(pipeline11.failingSuites().get(0).tests().size(), is(1));
assertThat(pipeline09.failingSuites().size(), is(0));
}
Aggregations