Skip to content

Commit 877c4d9

Browse files
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
1 parent 22ef081 commit 877c4d9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsFetchInterfaceCommandWrapperTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.UUID;
2727

2828
import org.junit.Assert;
29+
import org.junit.Assume;
2930
import org.junit.Test;
3031
import org.junit.runner.RunWith;
3132
import org.mockito.Spy;
@@ -51,8 +52,7 @@ public void testGetInterfaceDetailsValidValid() {
5152
while(interfaces.hasMoreElements()) {
5253
NetworkInterface networkInterface = interfaces.nextElement();
5354
if (networkInterface.getInetAddresses().hasMoreElements() &&
54-
(networkInterface.getName().startsWith("eth") ||
55-
networkInterface.getName().startsWith("wl"))) {
55+
networkInterface.getName().matches("^(eth|wl|en).*")) {
5656
interfaceName = networkInterface.getName();
5757
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
5858
while(addresses.hasMoreElements()) {
@@ -62,9 +62,13 @@ public void testGetInterfaceDetailsValidValid() {
6262
break;
6363
};
6464
}
65+
if (StringUtils.isNotBlank(interfaceName) && StringUtils.isNotBlank(ipAddress)) {
66+
break;
67+
}
6568
}
6669
}
6770
} catch (SocketException ignored) {}
71+
Assume.assumeTrue(StringUtils.isNotBlank(interfaceName));
6872
Ternary<String, String, String> result = null;
6973
try {
7074
result = wrapper.getInterfaceDetails(interfaceName);

0 commit comments

Comments
 (0)