[ 
https://issues.apache.org/jira/browse/GEODE-3469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16133807#comment-16133807
 ] 

ASF GitHub Bot commented on GEODE-3469:
---------------------------------------

Github user jaredjstewart commented on a diff in the pull request:

    https://github.com/apache/geode/pull/724#discussion_r134075476
  
    --- Diff: 
geode-core/src/test/java/org/apache/geode/internal/process/lang/AvailablePidTest.java
 ---
    @@ -100,7 +105,53 @@ public void 
findAvailablePidsShouldReturnNoDuplicatedPids() throws Exception {
         assertThatNoPidIsDuplicated(availablePid.findAvailablePids(8));
       }
     
    -  private void assertThatNoPidIsDuplicated(int[] pids) {
    +  @Test(timeout = DEFAULT_TIMEOUT_MILLIS)
    +  public void findAvailablePidShouldReturnGreaterThanOrEqualToLowerBound() 
throws Exception {
    +    availablePid = new AvailablePid(new AvailablePid.Bounds(1, 3));
    +
    +    int pid = availablePid.findAvailablePid();
    +
    +    assertThat(pid).isGreaterThanOrEqualTo(1);
    +  }
    +
    +  @Test(timeout = DEFAULT_TIMEOUT_MILLIS)
    +  public void findAvailablePidShouldReturnLessThanOrEqualToUpperBound() 
throws Exception {
    +    availablePid = new AvailablePid(new AvailablePid.Bounds(1, 3));
    +
    +    int pid = availablePid.findAvailablePid();
    +
    +    assertThat(pid).isLessThanOrEqualTo(3);
    +  }
    +
    +  @Test
    +  public void randomLowerBoundIsInclusive() throws Exception {
    +    availablePid = new AvailablePid(new AvailablePid.Bounds(1, 3));
    +
    +    await().atMost(10, SECONDS).until(() -> 
assertThat(availablePid.random()).isEqualTo(1));
    +  }
    +
    +  @Test
    +  public void randomUpperBoundIsInclusive() throws Exception {
    +    availablePid = new AvailablePid(new AvailablePid.Bounds(1, 3));
    +
    +    await().atMost(10, SECONDS).until(() -> 
assertThat(availablePid.random()).isEqualTo(3));
    --- End diff --
    
    This is a clever way to test that lower and upper bounds are potential 
output values!


> LocatorLauncherLocalFileIntegrationTest.usesLocatorPortAsDefaultPort fails 
> intermittently with IllegalArgumentException: Invalid pid '0' specified
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-3469
>                 URL: https://issues.apache.org/jira/browse/GEODE-3469
>             Project: Geode
>          Issue Type: Bug
>          Components: gfsh, tests
>            Reporter: Kirk Lund
>            Assignee: Kirk Lund
>
> {noformat}
> org.apache.geode.distributed.LocatorLauncherLocalFileIntegrationTest > 
> usesLocatorPortAsDefaultPort FAILED
>     java.lang.IllegalArgumentException: Invalid pid '0' specified
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to