From c6c3c16517347d07ffb7bdbbcd5a4087557ccefd Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 9 Apr 2019 16:52:44 +0200 Subject: [PATCH] Add auth API tests --- .circleci/config.yml | 19 +++++++++++++++++++ regression-tests.api/runtests | 4 +++- regression-tests.api/runtests.py | 8 +++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e209390f6d..4a3a658d6c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -452,6 +452,22 @@ jobs: - auth-regress: context: lmdb-nsec3-narrow + test-auth-api: + docker: + - image: debian:stretch + steps: + - auth-regress-setup + - run: apt-get -y -qq install virtualenv sqlite3 + - run: + name: Run API tests + workdir: ~/project/regression-tests.api + command: | + PDNSSERVER="/opt/pdns-auth/sbin/pdns_server" \ + PDNSUTIL="/opt/pdns-auth/bin/pdnsutil" \ + SDIG="/opt/pdns-auth/bin/sdig" \ + ZONE2SQL="/opt/pdns-auth/bin/zone2sql" \ + ./runtests authoritative + build-recursor: docker: - image: debian:stretch @@ -594,6 +610,9 @@ workflows: build-and-test-all: jobs: - build-auth + - test-auth-api: + requires: + - build-auth - test-auth-regress-odbc-sqlite3: requires: - build-auth diff --git a/regression-tests.api/runtests b/regression-tests.api/runtests index dac34dd10d..6574536d17 100755 --- a/regression-tests.api/runtests +++ b/regression-tests.api/runtests @@ -17,7 +17,9 @@ fi python -V pip install -r requirements.txt -export SDIG=$(type -P sdig) +if [ -z "${SDIG}" ]; then + export SDIG=$(type -P sdig) +fi set -e if [ "${PDNS_DEBUG}" = "YES" ]; then diff --git a/regression-tests.api/runtests.py b/regression-tests.api/runtests.py index 9263fcf19b..4ef9c1ca26 100755 --- a/regression-tests.api/runtests.py +++ b/regression-tests.api/runtests.py @@ -20,7 +20,7 @@ SQLITE_DB = 'pdns.sqlite3' WEBPORT = 5556 DNSPORT = 5300 APIKEY = '1234567890abcdefghijklmnopq-key' -PDNSUTIL_CMD = ["../pdns/pdnsutil", "--config-dir=."] +PDNSUTIL_CMD = [os.environ.get("PDNSUTIL", "../pdns/pdnsutil"), "--config-dir=."] NAMED_CONF_TPL = """ # Generated by runtests.py @@ -117,10 +117,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) @@ -128,7 +130,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") -- 2.47.2