]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
tests: added console assertions to config file template
authorMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 6 Aug 2015 17:57:32 +0000 (19:57 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 6 Aug 2015 18:04:23 +0000 (20:04 +0200)
.travis.yml
tests/kresd.j2
tests/test_integration.py

index 43d70a94e744dea64d111611963dc7deefe17e34..b72f0b3cb731b1204fec3e5e3a88d33cc1c26c90 100644 (file)
@@ -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
index 2795d4943ccf5ebff581c066e03e951f6057040c..211b3d3459a0d73dc76f97ab99556a3290703c08 100644 (file)
@@ -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)
index 1ed977cbc5c250572f06fb25896a1a28d6a680ef..263be89e3c8cde0689a12d0895fbe783668756e4 100755 (executable)
@@ -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