drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sohami <...@git.apache.org>
Subject [GitHub] drill pull request #648: DRILL-5015: Randomly select the drillbit from the l...
Date Thu, 10 Nov 2016 09:02:20 GMT
Github user sohami commented on a diff in the pull request:

    https://github.com/apache/drill/pull/648#discussion_r87351621
  
    --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/client/DrillClientSystemTest.java
---
    @@ -73,4 +77,90 @@ public void testSubmitPlanTwoNodes() throws Exception {
         }
         client.close();
       }
    +
    +  @Test
    +  public void testPopulateEndpointsList() throws Exception{
    +
    +    ArrayList<DrillbitEndpoint> endpointsList = new ArrayList<>();
    +    String drillBitConnection;
    +    DrillClient client = new DrillClient();
    +    DrillbitEndpoint endpoint;
    +    Iterator<DrillbitEndpoint> endpointIterator;
    +
    +
    +    // Test with single drillbit ip
    +    drillBitConnection = "10.10.100.161";
    +    client.populateEndpointsList(endpointsList, drillBitConnection);
    +    endpoint = endpointsList.iterator().next();
    +    assert(endpointsList.size() == 1);
    +    assert(endpoint.getAddress().equalsIgnoreCase(drillBitConnection));
    +    assert(endpoint.getUserPort() == client.getConfig().getInt(ExecConstants.INITIAL_USER_PORT));
    +
    +    // Test with single drillbit ip:port
    +    endpointsList.clear();
    +    drillBitConnection = "10.10.100.161:5000";
    +    String[] ipAndPort = drillBitConnection.split(":");
    +    client.populateEndpointsList(endpointsList, drillBitConnection);
    +    assert(endpointsList.size() == 1);
    +
    +    endpoint = endpointsList.iterator().next();
    +    assert(endpoint.getAddress().equalsIgnoreCase(ipAndPort[0]));
    +    assert(endpoint.getUserPort() == Integer.parseInt(ipAndPort[1]));
    +
    +    // Test with multiple drillbit ip
    +    endpointsList.clear();
    +    drillBitConnection = "10.10.100.161,10.10.100.162";
    +    client.populateEndpointsList(endpointsList, drillBitConnection);
    +    assert(endpointsList.size() == 2);
    +
    +    endpointIterator = endpointsList.iterator();
    +    endpoint = endpointIterator.next();
    +    assert(endpoint.getAddress().equalsIgnoreCase("10.10.100.161"));
    +    assert(endpoint.getUserPort() == client.getConfig().getInt(ExecConstants.INITIAL_USER_PORT));
    +
    +    endpoint = endpointIterator.next();
    +    assert(endpoint.getAddress().equalsIgnoreCase("10.10.100.162"));
    +    assert(endpoint.getUserPort() == client.getConfig().getInt(ExecConstants.INITIAL_USER_PORT));
    +
    +    // Test with multiple drillbit ip:port
    +    endpointsList.clear();
    +    drillBitConnection = "10.10.100.161:5000,10.10.100.162:5000";
    +    client.populateEndpointsList(endpointsList, drillBitConnection);
    +    assert(endpointsList.size() == 2);
    +
    +    endpointIterator = endpointsList.iterator();
    +    endpoint = endpointIterator.next();
    +    assert(endpoint.getAddress().equalsIgnoreCase("10.10.100.161"));
    +    assert(endpoint.getUserPort() == 5000);
    +
    +    endpoint = endpointIterator.next();
    +    assert(endpoint.getAddress().equalsIgnoreCase("10.10.100.162"));
    +    assert(endpoint.getUserPort() == 5000);
    +
    +    // Test with multiple drillbit with mix of ip:port and ip
    +    endpointsList.clear();
    +    drillBitConnection = "10.10.100.161:5000,10.10.100.162";
    +    client.populateEndpointsList(endpointsList, drillBitConnection);
    +    assert(endpointsList.size() == 2);
    +
    +    endpointIterator = endpointsList.iterator();
    +    endpoint = endpointIterator.next();
    +    assert(endpoint.getAddress().equalsIgnoreCase("10.10.100.161"));
    +    assert(endpoint.getUserPort() == 5000);
    +
    +    endpoint = endpointIterator.next();
    +    assert(endpoint.getAddress().equalsIgnoreCase("10.10.100.162"));
    +    assert(endpoint.getUserPort() == client.getConfig().getInt(ExecConstants.INITIAL_USER_PORT));
    +
    +    // Test with empty string
    +    endpointsList.clear();
    +    drillBitConnection = "";
    +    client.populateEndpointsList(endpointsList, drillBitConnection);
    +    assert(endpointsList.size() == 0);
    +
    +
    --- End diff --
    
    Added more test case based on new implementation


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message