This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.18 by this push:
     new 877c4d9a64b LibvirtOvsFetchInterfaceCommandWrapperTest fix (test fails 
in mac) - skip it if no interfaces with eth and wl (#9382)
877c4d9a64b is described below

commit 877c4d9a64b11ec1a692d5afd1cad9f6d17dab75
Author: Suresh Kumar Anaparti <sureshkumar.anapa...@gmail.com>
AuthorDate: Mon Jul 15 00:56:23 2024 +0530

    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
---
 .../wrapper/LibvirtOvsFetchInterfaceCommandWrapperTest.java       | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsFetchInterfaceCommandWrapperTest.java
 
b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsFetchInterfaceCommandWrapperTest.java
index fbc9c2bcb4b..b0df5519467 100644
--- 
a/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsFetchInterfaceCommandWrapperTest.java
+++ 
b/plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsFetchInterfaceCommandWrapperTest.java
@@ -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);

Reply via email to