drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul-rogers <...@git.apache.org>
Subject [GitHub] drill pull request #648: DRILL-5015: Randomly select the drillbit from the l...
Date Tue, 08 Nov 2016 22:53:51 GMT
Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/648#discussion_r87101810
  
    --- 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();
    --- End diff --
    
    Having to remember `endpointsList.clear( )` every time is error-prone. Better:
    
      {
          String drillBitConnection = "10.10.100.161";
          List<DrillEndpoint> endpointList = parseEndpoints( drillbitConnection );
          ... // Your tests here
        }
    
    The above creates a new block, and new case-specific variables, of each specific test.
Less chance of one test "bleeding through" into the next one.


---
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