use of alluxio.hub.proto.HubNodeStatus in project alluxio by Alluxio.
the class AgentProcessContextTest method testRegisterAgentSuccess.
@Test
public void testRegisterAgentSuccess() throws Exception {
assertEquals(0, mContext.getHubCluster().size());
InstancedConfiguration config = getTestSpecificConfig();
AgentProcessContext ctx = new AgentProcessContext(config, mClient);
RetryPolicy retry = new ExponentialBackoffRetry(5, 50, 10);
ctx.registerAgent(retry);
assertEquals(1, mContext.getHubCluster().size());
HubNodeStatus node = mContext.getHubCluster().toProto().getNode(0);
String host = NetworkAddressUtils.getConnectHost(NetworkAddressUtils.ServiceType.HUB_AGENT_RPC, config);
assertEquals(host, node.getNode().getHostname());
assertEquals(config.getInt(PropertyKey.HUB_AGENT_RPC_PORT), node.getNode().getRpcPort());
}
use of alluxio.hub.proto.HubNodeStatus in project alluxio by Alluxio.
the class ManagerAgentServiceTest method registerAgentTest.
@Test
public void registerAgentTest() {
RegisterAgentRequest req = RegisterAgentRequest.newBuilder().setNode(HubNodeAddress.newBuilder().setHostname("test-host").setRpcPort(54321).build()).build();
RegisterAgentResponse resp = mClient.registerAgent(req);
assertTrue(resp.hasOk());
assertEquals(1, mContext.getHubCluster().size());
assertTrue(mContext.getHubCluster().hosts().contains("test-host"));
HubNodeStatus node = mContext.getHubCluster().toProto().getNode(0);
assertTrue(node.hasNode());
assertTrue(node.hasState());
assertEquals("test-host", node.getNode().getHostname());
assertEquals(54321, node.getNode().getRpcPort());
assertEquals(HubNodeState.ALIVE, node.getState());
}
Aggregations