summaryrefslogtreecommitdiffstats
path: root/tests-extra
diff options
context:
space:
mode:
authorMark Karpilovskij <mark.karpilovskij@nic.cz>2018-11-05 13:25:25 +0100
committerMark Karpilovskij <mark.karpilovskij@nic.cz>2018-11-05 13:25:25 +0100
commit5092ac501cf529e1a0cd32859509eb884277e58b (patch)
tree91e24c5ea153e60002d559225291914e736086f8 /tests-extra
parentdelete unmaintained ycm config (diff)
downloadknot-5092ac501cf529e1a0cd32859509eb884277e58b.tar.xz
knot-5092ac501cf529e1a0cd32859509eb884277e58b.zip
tests-extra: skip geoip test when MMDB not available
Diffstat (limited to 'tests-extra')
-rw-r--r--tests-extra/tests/modules/geoip/test.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests-extra/tests/modules/geoip/test.py b/tests-extra/tests/modules/geoip/test.py
index 15594a78d..47b80f350 100644
--- a/tests-extra/tests/modules/geoip/test.py
+++ b/tests-extra/tests/modules/geoip/test.py
@@ -5,7 +5,22 @@
from dnstest.test import Test
from dnstest.module import ModGeoip
from dnstest.utils import *
+from subprocess import Popen, PIPE
import random
+import re
+
+def check_mmdb():
+ '''Checks the server binary for the MMDB_open function'''
+
+ try:
+ proc = Popen(ModGeoip._check_cmd(), stdout=PIPE, stderr=PIPE,
+ universal_newlines=True)
+ (out, err) = proc.communicate()
+ if re.search("MMDB_open", out):
+ return
+ raise Skip()
+ except:
+ raise Skip("libmaxminddb not detected")
t = Test(address=4, stress=False)
knot = t.server("knot")
@@ -14,6 +29,8 @@ zone = t.zone("example.com.", storage=".")
t.link(zone, knot)
ModGeoip.check()
+check_mmdb()
+
mod_geoip = ModGeoip(t.data_dir + "geo.conf", "geodb", t.data_dir + "db.mmdb", ["country/iso_code", "(id)city/geoname_id"])
knot.add_module(zone, mod_geoip);