use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldUsingIdleWhenRegistrationRequestIsFromAlreadyRegisteredAgent.
@Test
public void shouldUsingIdleWhenRegistrationRequestIsFromAlreadyRegisteredAgent() {
AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromServer(new Agent("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "linux");
assertThat(agentRuntimeInfo.getRuntimeStatus(), is(AgentRuntimeStatus.Idle));
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldNotMatchRuntimeInfosWithDifferentOperatingSystems.
@Test
public void shouldNotMatchRuntimeInfosWithDifferentOperatingSystems() {
AgentRuntimeInfo linux = AgentRuntimeInfo.fromServer(new Agent("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "linux");
AgentRuntimeInfo osx = AgentRuntimeInfo.fromServer(new Agent("uuid", "localhost", "176.19.4.1"), true, "/var/lib", 0L, "foo bar");
assertThat(linux, is(not(osx)));
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstancesTest method registerShouldThrowExceptionWhenMaxPendingAgentsLimitIsReached.
@Test
void registerShouldThrowExceptionWhenMaxPendingAgentsLimitIsReached() {
Agent agent = new Agent("uuid2", "CCeDev01", "10.18.5.1");
AgentInstances agentInstances = new AgentInstances(systemEnvironment, listener, pending());
when(systemEnvironment.get(MAX_PENDING_AGENTS_ALLOWED)).thenReturn(1);
MaxPendingAgentsLimitReachedException e = assertThrows(MaxPendingAgentsLimitReachedException.class, () -> agentInstances.register(fromServer(agent, false, "/var/lib", 0L, "linux")));
assertThat(e.getMessage(), is("Max pending agents allowed 1, limit reached"));
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstancesTest method createElasticAgent.
private Agent createElasticAgent(String uuid, String ip, String elasticAgentId, String elasticPluginId) {
Agent elasticAgent = new Agent(uuid);
elasticAgent.setElasticAgentId(elasticAgentId);
elasticAgent.setElasticPluginId(elasticPluginId);
elasticAgent.setIpaddress(ip);
return elasticAgent;
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstancesTest method createElasticAgentInstance.
private AgentInstance createElasticAgentInstance(int counter, String elasticPluginId) {
String uuid = UUID.randomUUID().toString();
String ip = "127.0.0.1";
String host = "localhost";
String elasticAgentId = "elastic-agent-id-" + counter;
AgentIdentifier id = new AgentIdentifier(host, ip, uuid);
ElasticAgentRuntimeInfo elasticRuntime = new ElasticAgentRuntimeInfo(id, Idle, "/foo/one", null, elasticAgentId, elasticPluginId);
Agent elasticAgent = createElasticAgent(uuid, ip, elasticAgentId, elasticPluginId);
AgentInstance elasticAgentInstance = createFromAgent(elasticAgent, new SystemEnvironment(), mock(AgentStatusChangeListener.class));
elasticAgentInstance.update(elasticRuntime);
return elasticAgentInstance;
}
Aggregations