Search in sources :

Example 16 with HubNodeAddress

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());
}
Also used : HubNodeAddress(alluxio.hub.proto.HubNodeAddress) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Example 17 with HubNodeAddress

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));
}
Also used : HubNodeAddress(alluxio.hub.proto.HubNodeAddress) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Aggregations

HubNodeAddress (alluxio.hub.proto.HubNodeAddress)17 BaseHubTest (alluxio.hub.test.BaseHubTest)13 Test (org.junit.Test)13 HashMap (java.util.HashMap)6 Map (java.util.Map)3 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)3 Pair (alluxio.collections.Pair)2 AgentFileUploadResponse (alluxio.hub.proto.AgentFileUploadResponse)2 AgentListCatalogResponse (alluxio.hub.proto.AgentListCatalogResponse)2 AlluxioConfigurationSet (alluxio.hub.proto.AlluxioConfigurationSet)2 AlluxioNodeType (alluxio.hub.proto.AlluxioNodeType)2 PrestoCatalogListing (alluxio.hub.proto.PrestoCatalogListing)2 UploadFile (alluxio.hub.proto.UploadFile)2 IOException (java.io.IOException)2 Path (java.nio.file.Path)2 Collections (java.util.Collections)2 List (java.util.List)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 After (org.junit.After)2 Assert.assertEquals (org.junit.Assert.assertEquals)2