use of alluxio.hub.proto.HubNodeAddress in project alluxio by Alluxio.
the class HubClusterTest method testLostNode.
@Test
public void testLostNode() throws InterruptedException {
HubNodeAddress addr = generateNodeAddress();
mCluster = new HubCluster(mSvc, 250, 400);
mCluster.heartbeat(addr);
assertEquals(1, mCluster.size());
// wait until the lost time has passed
Thread.sleep(255);
// scan over the nodes
mCluster.scanNodes();
assertEquals(1, mCluster.size());
assertEquals(HubNodeState.LOST, mCluster.toProto().getNode(0).getState());
Thread.sleep(150);
// scan over the nodes again
mCluster.scanNodes();
// the node should be deleted
assertEquals(0, mCluster.size());
}
use of alluxio.hub.proto.HubNodeAddress in project alluxio by Alluxio.
the class HubClusterTest method testNodesFromAlluxio.
@Test
public void testNodesFromAlluxio() {
AlluxioCluster ac = mCluster.getAlluxioCluster();
HubNodeAddress addr1 = generateNodeAddress();
HubNodeAddress addr2 = generateNodeAddress();
mCluster.add(addr1);
mCluster.add(addr2);
ac.heartbeat(hubStatusToAlluxioStatus(addr1, AlluxioNodeType.MASTER, AlluxioNodeType.JOB_MASTER));
ac.heartbeat(hubStatusToAlluxioStatus(addr2, AlluxioNodeType.WORKER, AlluxioNodeType.JOB_WORKER));
assertTrue(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.MASTER).contains(addr1));
assertFalse(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.MASTER).contains(addr2));
assertTrue(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.JOB_MASTER).contains(addr1));
assertFalse(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.JOB_MASTER).contains(addr2));
assertTrue(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.WORKER).contains(addr2));
assertFalse(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.WORKER).contains(addr1));
assertTrue(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.JOB_WORKER).contains(addr2));
assertFalse(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.JOB_WORKER).contains(addr1));
assertFalse(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.PROXY).contains(addr1));
assertFalse(mCluster.nodesFromAlluxio(ac, AlluxioNodeType.PROXY).contains(addr2));
}
Aggregations