use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class AgentInstanceTest method shouldNotChangePendingAgentIpAddress.
@Test
public void shouldNotChangePendingAgentIpAddress() throws Exception {
AgentInstance pending = AgentInstance.createFromLiveAgent(new AgentRuntimeInfo(agentConfig.getAgentIdentifier(), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), systemEnvironment);
AgentRuntimeInfo info = new AgentRuntimeInfo(new AgentIdentifier("ccedev01", "10.18.7.52", "uuid"), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
assertThat(pending.isIpChangeRequired(info.getIpAdress()), is(false));
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class AgentHTTPClientController method retrieveWork.
void retrieveWork() {
AgentIdentifier agentIdentifier = agentIdentifier();
LOG.debug("[Agent Loop] {} is checking for work from Go", agentIdentifier);
Work work;
try {
getAgentRuntimeInfo().idle();
work = server.getWork(getAgentRuntimeInfo());
if (!(work instanceof NoWork)) {
LOG.debug("[Agent Loop] Got work from server: [{}]", work.description());
}
runner = new JobRunner();
runner.run(work, agentIdentifier, server, manipulator, getAgentRuntimeInfo(), packageRepositoryExtension, scmExtension, taskExtension);
} catch (UnregisteredAgentException e) {
LOG.warn("[Agent Loop] Invalid agent certificate with fingerprint {}. Registering with server on next iteration.", e.getUuid());
sslInfrastructureService.invalidateAgentCertificate();
} finally {
getAgentRuntimeInfo().idle();
}
}
use of com.thoughtworks.go.remote.AgentIdentifier in project gocd by gocd.
the class DependencyMaterialAgentTest method shouldBeCreatedByAgentFactory.
@Test
public void shouldBeCreatedByAgentFactory() {
MaterialAgentFactory factory = new MaterialAgentFactory(ProcessOutputStreamConsumer.inMemoryConsumer(), new File("blah"), new AgentIdentifier("", "", ""), null, null);
MaterialAgent createdAgent = factory.createAgent(materialRevision("pipeline-name", 1, "pipeline-label", "stage-name", 1));
assertThat(createdAgent, instanceOf(DependencyMaterialAgent.class));
}
use of com.thoughtworks.go.remote.AgentIdentifier 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.remote.AgentIdentifier in project gocd by gocd.
the class BuildWorkArtifactUploadingTest method shouldUploadFolderWhenTrimedPathDirectMatch.
@Test
public void shouldUploadFolderWhenTrimedPathDirectMatch() throws Exception {
ArtifactPlans artifactPlans = new ArtifactPlans();
artifactPlans.add(new ArtifactPlan("logs/pic-1 ", "mypic"));
BuildAssignment buildAssigment = createAssignment(artifactPlans, new String[] { "logs/pic-1/fail.png", "logs/pic-1/pass.png", "logs/pic-2/cancel.png", "logs/pic-2/complete.png", "README" });
BuildWork work = new BuildWork(buildAssigment);
GoArtifactsManipulatorStub manipulator = new GoArtifactsManipulatorStub();
AgentIdentifier agentIdentifier = new AgentIdentifier("somename", "127.0.0.1", AGENT_UUID);
work.doWork(agentIdentifier, new FakeBuildRepositoryRemote(), manipulator, environmentVariableContext, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), packageRepositoryExtension, scmExtension, taskExtension);
List<UploadEntry> entries = manipulator.uploadEntries();
assertThat(entries, uploadFileToDestination(new File(buildWorkingDirectory.getPath() + "/logs/pic-1"), "mypic"));
}
Aggregations