Search in sources :

Example 1 with AlluxioCluster

use of alluxio.hub.proto.AlluxioCluster in project alluxio by Alluxio.

the class AgentProcessContextTest method testHeartbeatSuccess.

@Test
public void testHeartbeatSuccess() throws Exception {
    InstancedConfiguration config = getTestSpecificConfig();
    AgentProcessContext ctx = new AgentProcessContext(config, mClient);
    CommonUtils.waitFor("cluster size to be > 0", () -> mContext.getAlluxioCluster().size() > 0, WaitForOptions.defaults().setInterval(100).setTimeoutMs(5000));
    assertEquals(1, mContext.getAlluxioCluster().size());
    AlluxioCluster c = mContext.getAlluxioCluster().toProto();
    AlluxioNodeStatus nodeStatus = c.getNode(0);
    String host = NetworkAddressUtils.getConnectHost(NetworkAddressUtils.ServiceType.HUB_AGENT_RPC, config);
    assertEquals(host, nodeStatus.getHostname());
    assertThrows(Exception.class, ctx::startHeartbeat);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioCluster(alluxio.hub.proto.AlluxioCluster) AlluxioNodeStatus(alluxio.hub.proto.AlluxioNodeStatus) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Example 2 with AlluxioCluster

use of alluxio.hub.proto.AlluxioCluster in project alluxio by Alluxio.

the class ManagerAgentServiceTest method agentHeartbeatTest.

@Test
public void agentHeartbeatTest() {
    AlluxioNodeStatus s = AlluxioNodeStatus.newBuilder().setHostname(UUID.randomUUID().toString()).addProcess(AlluxioProcessStatus.newBuilder().setState(ProcessState.RUNNING).setNodeType(AlluxioNodeType.MASTER).build()).build();
    HubNodeAddress addr = HubNodeAddress.newBuilder().setHostname(UUID.randomUUID().toString()).setRpcPort(56565).build();
    AgentHeartbeatRequest request = AgentHeartbeatRequest.newBuilder().setAlluxioStatus(s).setHubNode(addr).build();
    AgentHeartbeatResponse resp = mClient.agentHeartbeat(request);
    assertTrue(resp.hasOk());
    assertTrue(resp.getOk());
    assertEquals(1, mContext.getAlluxioCluster().size());
    AlluxioCluster c = mContext.getAlluxioCluster().toProto();
    AlluxioNodeStatus nodeStatus = c.getNode(0);
    assertEquals(s.getHostname(), nodeStatus.getHostname());
    assertEquals(AlluxioNodeType.MASTER, nodeStatus.getProcess(0).getNodeType());
    assertEquals(ProcessState.RUNNING, nodeStatus.getProcess(0).getState());
}
Also used : HubNodeAddress(alluxio.hub.proto.HubNodeAddress) AlluxioCluster(alluxio.hub.proto.AlluxioCluster) AgentHeartbeatRequest(alluxio.hub.proto.AgentHeartbeatRequest) AlluxioNodeStatus(alluxio.hub.proto.AlluxioNodeStatus) AgentHeartbeatResponse(alluxio.hub.proto.AgentHeartbeatResponse) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Aggregations

AlluxioCluster (alluxio.hub.proto.AlluxioCluster)2 AlluxioNodeStatus (alluxio.hub.proto.AlluxioNodeStatus)2 BaseHubTest (alluxio.hub.test.BaseHubTest)2 Test (org.junit.Test)2 InstancedConfiguration (alluxio.conf.InstancedConfiguration)1 AgentHeartbeatRequest (alluxio.hub.proto.AgentHeartbeatRequest)1 AgentHeartbeatResponse (alluxio.hub.proto.AgentHeartbeatResponse)1 HubNodeAddress (alluxio.hub.proto.HubNodeAddress)1