[ 
https://issues.apache.org/jira/browse/ARTEMIS-2792?focusedWorklogId=441243&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-441243
 ]

ASF GitHub Bot logged work on ARTEMIS-2792:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jun/20 12:23
            Start Date: 04/Jun/20 12:23
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on a change in pull request 
#3166:
URL: https://github.com/apache/activemq-artemis/pull/3166#discussion_r435211313



##########
File path: 
artemis-commons/src/test/java/org/apache/activemq/artemis/utils/NetworkHealthTest.java
##########
@@ -326,4 +327,32 @@ public boolean purePing(InetAddress address) throws 
IOException, InterruptedExce
       Assert.assertEquals(0, purePing.get());
    }
 
+   @Test
+   public void testPurePingTimeout() throws Exception {
+      NetworkHealthCheck check = new NetworkHealthCheck(null, 100, 3000);
+
+      CountDownLatch purePingLatch = new CountDownLatch(1);
+      CountDownLatch purePingThreadLatch = new CountDownLatch(1);
+
+      Thread purePingThread = new Thread(new Runnable() {
+         @Override
+         public void run() {
+            try {
+               purePingThreadLatch.countDown();
+
+               //[RFC1166] reserves the address block 192.0.2.0/24 for test.
+               
Assert.assertFalse(check.purePing(InetAddress.getByName("192.0.2.0")));
+
+               purePingLatch.countDown();
+            } catch (Exception e) {
+               Assert.fail("Unexpected exception: " + e.toString());
+            }
+         }
+      });
+
+      purePingThread.start();
+      purePingThreadLatch.await();
+      Assert.assertTrue(purePingLatch.await(5000, TimeUnit.MILLISECONDS));

Review comment:
       you need to assert the timeout was respected here.
   
   Can I amend your test as this and merge it?
   
   
   ```java
         purePingThread.start();
         long time = System.currentTimeMillis();
         purePingThreadLatch.await();
         Assert.assertTrue(purePingLatch.await(5000, TimeUnit.MILLISECONDS));
         Assert.assertTrue(System.currentTimeMillis() - time >= 2000);
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 441243)
    Time Spent: 20m  (was: 10m)

> Wrong default network pinger command for linux
> ----------------------------------------------
>
>                 Key: ARTEMIS-2792
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2792
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Domenico Bruscino
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The network pinger uses a network timeout as an argument for -t in the ping 
> command.
> The linux man page for ping says -t sets TTL, which is "The TTL value of an 
> IP packet represents the maximum number of IP routers that the packet can go 
> through before being thrown away. In current practice you can expect each 
> router in the Internet to decrement the TTL field by exactly one."
> It looks like the intent was to use -w timeout, in seconds, before ping exits 
> regardless of how many packets have been sent or received.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to