-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50562/#review147228
-----------------------------------------------------------



This is not your fault however let's clean up this test a little to make it 
less flaky.

Could you please do this for both the TCP and the UDP sources?


flume-ng-core/src/test/java/org/apache/flume/source/TestSyslogUdpSource.java 
(line 201)
<https://reviews.apache.org/r/50562/#comment214343>

    Prefer InetAddress.getLoopbackAddress(), which does not rely on the machine 
having a DNS entry and will not throw UnknownHostException.
    
    However... even better than this would be to expose a method 
getBoundAddress() on the source itself that returns the bind address, similar 
to how it's done for the port. In fact, you can just replace the port one with 
the bound address one. Something like this:
    
      @VisibleForTesting
      public InetSocketAddress getBoundAddress() {
        SocketAddress localAddress = nettyChannel.getLocalAddress();
        if (!(localAddress instanceof InetSocketAddress)) {
          throw IllegalArgumentException("Not bound to an internet address");
        }
        return (InetSocketAddress) localAddress;
      }
    
    Then use:
    
      InetAddress addr = source.getBoundAddress();
      return new DatagramPacket(payload, payload.length, 
boundAddr.getAddress(), boundAddr.getPort());


- Mike Percy


On Aug. 18, 2016, 6:44 a.m., Denes Arvay wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50562/
> -----------------------------------------------------------
> 
> (Updated Aug. 18, 2016, 6:44 a.m.)
> 
> 
> Review request for Flume, Balázs Donát Bessenyei, Mike Percy, and Attila 
> Simon.
> 
> 
> Bugs: FLUME-2797
>     https://issues.apache.org/jira/browse/FLUME-2797
> 
> 
> Repository: flume-git
> 
> 
> Description
> -------
> 
> Patch for FLUME-2797 - SyslogTcpSource uses Deprecated Class + Deprecate 
> SyslogTCPSource
> 
> 
> Diffs
> -----
> 
>   flume-ng-core/src/main/java/org/apache/flume/source/SyslogTcpSource.java 
> 185c00c 
>   flume-ng-core/src/main/java/org/apache/flume/source/SyslogUDPSource.java 
> 175bebb 
>   
> flume-ng-core/src/test/java/org/apache/flume/source/TestSyslogTcpSource.java 
> 10ef8d8 
>   
> flume-ng-core/src/test/java/org/apache/flume/source/TestSyslogUdpSource.java 
> e5b7a06 
> 
> Diff: https://reviews.apache.org/r/50562/diff/
> 
> 
> Testing
> -------
> 
> - checkstyle passes
> - `flume-ng-core` tests pass
> - 2 new tests added
> 
> 
> Thanks,
> 
> Denes Arvay
> 
>

Reply via email to