]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virfirewallmock: Replace virFindFileInPath() with virFirewallDIsRegistered()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 3 May 2023 08:44:10 +0000 (10:44 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 May 2023 12:44:22 +0000 (14:44 +0200)
Neither of tests that use virfirewallmock.c
(networkxml2firewalltest, nwfilterebiptablestest,
nwfilterxml2firewalltest, virfirewalltest) really call
virFindFileInPath(). But at least networkxml2firewalltest calls
virFirewallDIsRegistered(), under the hood. Now, the actual
implementation connects to dbus and something, which is
definitely not what we want in our test suite.

Therefore, drop virFindFileInPath() implementation and provide
implementation for virFirewallDIsRegistered() which just returns
-2 to signal that firewalld is not registered.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
tests/virfirewallmock.c

index 6b096701c9bef9a1ebe4beaa2856cc11d07e843b..793b954d87cafaf3b2aea9f5041da53715ae6c01 100644 (file)
 #include <config.h>
 
 #include "internal.h"
-#include "virfile.h"
+#include "virfirewalld.h"
 
-char *
-virFindFileInPath(const char *file)
+int
+virFirewallDIsRegistered(void)
 {
-    if (file &&
-        (g_strrstr(file, "ebtables") ||
-         g_strrstr(file, "iptables") ||
-         g_strrstr(file, "ip6tables"))) {
-        return g_strdup(file);
-    }
-
-    /* We should not need any other binaries so return NULL. */
-    return NULL;
+    return -2;
 }