]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - regression-tests.api/runtests.py
Merge pull request #8223 from PowerDNS/omoerbeek-patch-1
[thirdparty/pdns.git] / regression-tests.api / runtests.py
index 45145a6181fbbd6f37d8446574ae14d9df6146fb..f9f4dba1798222aa058b3ac0e6a647c485f4cd23 100755 (executable)
@@ -11,11 +11,17 @@ import sys
 import tempfile
 import time
 
+try:
+  raw_input
+except NameError:
+  raw_input = input
+
 SQLITE_DB = 'pdns.sqlite3'
 WEBPORT = 5556
 DNSPORT = 5300
 APIKEY = '1234567890abcdefghijklmnopq-key'
-PDNSUTIL_CMD = ["../pdns/pdnsutil", "--config-dir=."]
+WEBPASSWORD = 'something'
+PDNSUTIL_CMD = [os.environ.get("PDNSUTIL", "../pdns/pdnsutil"), "--config-dir=."]
 
 NAMED_CONF_TPL = """
 # Generated by runtests.py
@@ -32,6 +38,7 @@ gsqlite3-dnssec=on
 gsqlite3-database="""+SQLITE_DB+"""
 module-dir=../regression-tests/modules
 bind-config=bindbackend.conf
+default-soa-edit=INCEPTION-INCREMENT
 """
 
 BINDBACKEND_CONF_TPL = """
@@ -98,7 +105,8 @@ pdns_recursor = os.environ.get("PDNSRECURSOR", "../pdns/recursordist/pdns_recurs
 common_args = [
     "--daemon=no", "--socket-dir=.", "--config-dir=.",
     "--local-address=127.0.0.1", "--local-port="+str(DNSPORT),
-    "--webserver=yes", "--webserver-port="+str(WEBPORT), "--webserver-address=127.0.0.1", "--webserver-password=something",
+    "--webserver=yes", "--webserver-port="+str(WEBPORT), "--webserver-address=127.0.0.1",
+    "--webserver-password="+WEBPASSWORD,
     "--api-key="+APIKEY
 ]
 
@@ -112,10 +120,12 @@ if not sdig or not os.path.exists(sdig):
 
 
 if daemon == 'authoritative':
+    zone2sql = os.environ.get("ZONE2SQL", "../pdns/zone2sql")
 
     # Prepare sqlite DB with some zones.
     run_check_call(["rm", "-f", SQLITE_DB])
-    run_check_call(["make", "-C", "../pdns", "zone2sql"])
+    if zone2sql == "../pdns/zone2sql":
+        run_check_call(["make", "-C", "../pdns", "zone2sql"])
 
     with open('../modules/gsqlite3backend/schema.sqlite3.sql', 'r') as schema_file:
         run_check_call(["sqlite3", SQLITE_DB], stdin=schema_file)
@@ -123,7 +133,7 @@ if daemon == 'authoritative':
     with open('named.conf', 'w') as named_conf:
         named_conf.write(NAMED_CONF_TPL)
     with tempfile.TemporaryFile() as tf:
-        p = subprocess.Popen(["../pdns/zone2sql", "--transactions", "--gsqlite", "--named-conf=named.conf"], stdout=tf)
+        p = subprocess.Popen([zone2sql, "--transactions", "--gsqlite", "--named-conf=named.conf"], stdout=tf)
         p.communicate()
         if p.returncode != 0:
             raise Exception("zone2sql failed")
@@ -181,6 +191,7 @@ returncode = 0
 test_env = {}
 test_env.update(os.environ)
 test_env.update({
+    'WEBPASSWORD': WEBPASSWORD,
     'WEBPORT': str(WEBPORT),
     'APIKEY': APIKEY,
     'DAEMON': daemon,