[PATCH 05/20] networkxml2conftest: Fail tests where no dnsmasq would be spawned

Michal Privoznik via Devel posted 20 patches 4 days, 15 hours ago
[PATCH 05/20] networkxml2conftest: Fail tests where no dnsmasq would be spawned
Posted by Michal Privoznik via Devel 4 days, 15 hours ago
From: Michal Privoznik <mprivozn@redhat.com>

If network config does not require dnsmasq then none is spawned.
Having a test case that would still require generating dnsmasq
config is weird and can lead to spurious results. Just fail such
test case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/networkxml2conftest.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index aa0adbdd52..59ab3a402b 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -41,6 +41,11 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf,
 
     virNetworkObjSetDef(obj, def);
 
+    if (!networkNeedsDnsmasq(def)) {
+        VIR_TEST_VERBOSE("spurious request to generate conf files. Would not start dnsmasq in real life scenario");
+        goto fail;
+    }
+
     dctx = dnsmasqContextNew(def->name, "/var/lib/libvirt/dnsmasq");
 
     if (dctx == NULL)
-- 
2.52.0