LibvirtOvsFetchInterfaceCommandWrapperTest fix (test fails in mac) - skip it if no interfaces with eth and wl (#9382)

* test fix (fails in mac) - skip it if no interfaces with eth and wl

* review comments
This commit is contained in:
Suresh Kumar Anaparti 2024-07-15 00:56:23 +05:30 committed by GitHub
parent 22ef08154d
commit 877c4d9a64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -26,6 +26,7 @@ import java.util.List;
import java.util.UUID;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Spy;
@ -51,8 +52,7 @@ public class LibvirtOvsFetchInterfaceCommandWrapperTest {
while(interfaces.hasMoreElements()) {
NetworkInterface networkInterface = interfaces.nextElement();
if (networkInterface.getInetAddresses().hasMoreElements() &&
(networkInterface.getName().startsWith("eth") ||
networkInterface.getName().startsWith("wl"))) {
networkInterface.getName().matches("^(eth|wl|en).*")) {
interfaceName = networkInterface.getName();
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
while(addresses.hasMoreElements()) {
@ -62,9 +62,13 @@ public class LibvirtOvsFetchInterfaceCommandWrapperTest {
break;
};
}
if (StringUtils.isNotBlank(interfaceName) && StringUtils.isNotBlank(ipAddress)) {
break;
}
}
}
} catch (SocketException ignored) {}
Assume.assumeTrue(StringUtils.isNotBlank(interfaceName));
Ternary<String, String, String> result = null;
try {
result = wrapper.getInterfaceDetails(interfaceName);