From dcaab90f0dda5900d260b3fa79cb498f8a67b674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Vavru=C5=A1a?= <marek.vavrusa@nic.cz> Date: Thu, 6 Aug 2015 19:57:32 +0200 Subject: [PATCH] tests: added console assertions to config file template --- .travis.yml | 2 +- tests/kresd.j2 | 20 ++++++++++++++++++-- tests/test_integration.py | 2 ++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43d70a94e..b72f0b3cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ before_script: - ./scripts/bootstrap-depends.sh ${HOME}/.local script: - make ${MAKEOPTS} install COVERAGE=1 PREFIX=${HOME}/.local - - make check COVERAGE=1 PREFIX=${HOME}/.local + - make ${MAKEOPTS} check COVERAGE=1 PREFIX=${HOME}/.local after_success: - test $TRAVIS_OS_NAME = linux && coveralls -i lib -i daemon -x ".c" --gcov-options '\-lp' sudo: false diff --git a/tests/kresd.j2 b/tests/kresd.j2 index 2795d4943..211b3d345 100644 --- a/tests/kresd.j2 +++ b/tests/kresd.j2 @@ -1,7 +1,23 @@ net.listen('{{SELF_ADDR}}',53) -cache.size = 10*MB -modules = {'block','hints'} +cache.size = 1*MB +modules = {'stats', 'block', 'hints'} hints.root({['k.root-servers.net'] = '{{ROOT_ADDR}}'}) option('NO_MINIMIZE', {{NO_MINIMIZE}}) option('ALLOW_LOCAL', true) +-- Self-checks on globals +assert(help() ~= nil) +assert(worker.id ~= nil) +-- Self-checks on facilities +assert(cache.count() == 0) +assert(cache.stats() ~= nil) +assert(cache.backends() ~= nil) +assert(worker.stats() ~= nil) +assert(net.interfaces() ~= nil) +-- Self-checks on loaded stuff +assert(net.list()['{{SELF_ADDR}}']) +assert(#modules.list() > 0) +-- Self-check timers +ev = event.recurrent(1 * sec, function (ev) return 1 end) +event.cancel(ev) +ev = event.after(0, function (ev) return 1 end) diff --git a/tests/test_integration.py b/tests/test_integration.py index 1ed977cbc..263be89e3 100755 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -236,6 +236,8 @@ def play_object(path, binary_name, config_name, j2template, binary_additional_pa # Wait until the server accepts TCP clients sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while True: + if daemon_proc.poll() != None: + raise Exception('process died "%s", logs in "%s"' % (os.path.basename(binary_name), TMPDIR)) try: sock.connect((testserver.get_local_addr_str(socket.AF_INET, CHILD_IFACE), 53)) except: continue -- GitLab