use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class BuildWorkArtifactUploadingTest method shouldFailBuildWhenNothingMatchedUsingMatcherStartDotStart.
@Test
public void shouldFailBuildWhenNothingMatchedUsingMatcherStartDotStart() throws Exception {
ArtifactPlans artifactPlans = new ArtifactPlans();
artifactPlans.add(new ArtifactPlan("target/pkg/*.*", "MYDEST"));
BuildAssignment buildAssigment = createAssignment(artifactPlans, new String[] { "target/pkg/" });
BuildWork work = new BuildWork(buildAssigment);
GoArtifactsManipulatorStub manipulator = new GoArtifactsManipulatorStub();
BuildRepositoryRemoteStub repository = new BuildRepositoryRemoteStub();
AgentIdentifier agentIdentifier = new AgentIdentifier("somename", "127.0.0.1", AGENT_UUID);
work.doWork(agentIdentifier, repository, manipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
List<UploadEntry> entries = manipulator.uploadEntries();
assertThat(entries.size(), is(0));
assertThat(repository.states, containsResult(JobState.Building));
assertThat(repository.states, containsResult(JobState.Completing));
assertThat(repository.results, containsResult(JobResult.Failed));
assertThat(manipulator.consoleOut(), printedRuleDoesNotMatchFailure(buildWorkingDirectory.getPath(), "target/pkg/*.*"));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldHaveBeautifulPhigureLikeDisplayString.
@Test
public void shouldHaveBeautifulPhigureLikeDisplayString() throws Exception {
AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
agentRuntimeInfo.setLocation("/nim/appan/mane");
assertThat(agentRuntimeInfo.agentInfoForDisplay(), is("Agent located at [localhost, 127.0.0.1, /nim/appan/mane]"));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldHaveRelevantFieldsInDebugString.
@Test
public void shouldHaveRelevantFieldsInDebugString() throws Exception {
AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
assertThat(agentRuntimeInfo.agentInfoDebugString(), is("Agent [localhost, 127.0.0.1, uuid, cookie]"));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldUpdateSelfForAnIdleAgent.
@Test
public void shouldUpdateSelfForAnIdleAgent() {
AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), null, false);
AgentRuntimeInfo newRuntimeInfo = new AgentRuntimeInfo(new AgentIdentifier("go02", "10.10.10.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
newRuntimeInfo.setBuildingInfo(new AgentBuildingInfo("Idle", ""));
newRuntimeInfo.setLocation("home");
newRuntimeInfo.setUsableSpace(10L);
newRuntimeInfo.setOperatingSystem("Linux");
agentRuntimeInfo.updateSelf(newRuntimeInfo);
assertThat(agentRuntimeInfo.getBuildingInfo(), is(newRuntimeInfo.getBuildingInfo()));
assertThat(agentRuntimeInfo.getLocation(), is(newRuntimeInfo.getLocation()));
assertThat(agentRuntimeInfo.getUsableSpace(), is(newRuntimeInfo.getUsableSpace()));
assertThat(agentRuntimeInfo.getOperatingSystem(), is(newRuntimeInfo.getOperatingSystem()));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldTellIfHasCookie.
@Test
public void shouldTellIfHasCookie() throws Exception {
assertThat(new AgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false).hasDuplicateCookie("cookie"), is(false));
assertThat(new AgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false).hasDuplicateCookie("different"), is(true));
assertThat(new AgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), null, false).hasDuplicateCookie("cookie"), is(false));
assertThat(new AgentRuntimeInfo(new AgentIdentifier("localhost", "127.0.0.1", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false).hasDuplicateCookie(null), is(false));
}
Aggregations