summaryrefslogtreecommitdiffstats
path: root/tests-extra
diff options
context:
space:
mode:
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);