Skip to content

Commit

Permalink
Fix NetworkUtilsTests
Browse files Browse the repository at this point in the history
* Follow up to elastic#42109:
   * Now that we know that the test failures come from `veth` type network interfaces being created/destroyed concurrently to the test run, we can fix this test by simply ignoring these interfaces to prevent making a syscall to them when they don't exist anymore
  • Loading branch information
original-brownbear committed Jun 17, 2019
1 parent 551353d commit 675b97b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ public void testFilter() throws Exception {
public void testAddressInterfaceLookup() throws Exception {
for (NetworkInterface netIf : NetworkUtils.getInterfaces()) {
try {
if (!netIf.isUp() || Collections.list(netIf.getInetAddresses()).isEmpty()) {
// Ignoring virtual ethernet devices since e.g. Docker could be creating or removing them in the background breaking tests.
final String interfaceName = netIf.getName();
if ((interfaceName != null && interfaceName.startsWith("veth")) || netIf.isUp() == false
|| Collections.list(netIf.getInetAddresses()).isEmpty()) {
continue;
}
} catch (SocketException e) {
Expand Down

0 comments on commit 675b97b

Please sign in to comment.