use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentRuntimeInfoTest method shouldReturnTrueIfUsableSpaceLessThanLimit.
@Test
public void shouldReturnTrueIfUsableSpaceLessThanLimit() {
AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.initialState(new Agent("uuid"));
agentRuntimeInfo.setUsableSpace(10L);
assertThat(agentRuntimeInfo.isLowDiskSpace(20L), is(true));
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceTest method setUp.
@BeforeEach
void setUp() {
systemEnvironment = new SystemEnvironment();
agent = new Agent("uuid2", "CCeDev01", DEFAULT_IP_ADDRESS);
defaultBuildingInfo = new AgentBuildingInfo("pipeline", "buildLocator");
agentStatusChangeListener = mock(AgentStatusChangeListener.class);
timeProvider = mock(TimeProvider.class);
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceTest method shouldMarkAgentAsMissingWhenLastHeardTimeIsNull.
@Test
void shouldMarkAgentAsMissingWhenLastHeardTimeIsNull() {
Agent agent = new Agent("1234", "localhost", "192.168.0.1");
AgentInstance agentInstance = AgentInstance.createFromAgent(agent, new SystemEnvironment(), mock(AgentStatusChangeListener.class));
agentInstance.refresh();
assertThat(agentInstance.getRuntimeStatus()).isEqualTo(AgentRuntimeStatus.Missing);
assertThat(agentInstance.getLastHeardTime()).isNotNull();
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceTest method syncConfigShouldUpdateElasticAgentRuntimeInfo.
@Test
void syncConfigShouldUpdateElasticAgentRuntimeInfo() {
AgentInstance agentInstance = AgentInstanceMother.idle();
Agent agent = new Agent(agentInstance.getUuid(), agentInstance.getHostname(), agentInstance.getIpAddress());
agent.setElasticAgentId("i-123456");
agent.setElasticPluginId("com.example.aws");
assertThat(agentInstance.isElastic()).isFalse();
agentInstance.syncAgentFrom(agent);
assertThat(agentInstance.isElastic()).isTrue();
assertThat(agentInstance.elasticAgentMetadata().elasticAgentId()).isEqualTo("i-123456");
assertThat(agentInstance.elasticAgentMetadata().elasticPluginId()).isEqualTo("com.example.aws");
}
use of com.thoughtworks.go.config.Agent in project gocd by gocd.
the class AgentInstanceTest method shouldNotBeEqualIfUuidIsNotEqual.
@Test
void shouldNotBeEqualIfUuidIsNotEqual() {
AgentInstance agentA = new AgentInstance(new Agent("UUID", "A", "127.0.0.1"), LOCAL, systemEnvironment, null);
AgentInstance copyOfAgentA = new AgentInstance(new Agent("UUID", "A", "127.0.0.1"), LOCAL, systemEnvironment, null);
AgentInstance agentB = new AgentInstance(new Agent("UUID", "B", "127.0.0.2"), LOCAL, systemEnvironment, null);
assertThat(agentA).isNotEqualTo(agentB);
assertThat(agentB).isNotEqualTo(agentA);
assertThat(agentA).isEqualTo(copyOfAgentA);
}
Aggregations