forked from CZ-NIC/knot-resolver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a9e7f3
commit 65ad94d
Showing
1 changed file
with
68 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,86 @@ | ||
.. SPDX-License-Identifier: GPL-3.0-or-later | ||
Tests | ||
===== | ||
|
||
The following is a non-comprehensitve lists of various tests that can be found | ||
in this repo. | ||
|
||
Unit tests | ||
========== | ||
---------- | ||
|
||
The unit tests depend on cmocka_. | ||
The unit tests depend on cmocka_ and can easily be executed after compilation. | ||
They are enabled by default. | ||
|
||
.. code-block:: bash | ||
$ make check | ||
$ meson test -C build_dir --suite unit | ||
Config tests | ||
------------ | ||
|
||
Config tests utilize the kresd's lua config file to execute arbitrary tests, | ||
typically testing various modules, their API etc. | ||
|
||
These tests require installed kresd. The binary ``kresd`` found in ``$PATH`` | ||
will be tested. When testing through meson, ``$PATH`` is modified automatically | ||
and you just need to make sure to install kresd first. | ||
|
||
.. todo:: Writing tests. | ||
To enable these tests, specify ``-Dconfig_tests=enabled`` option for meson. | ||
Multiple dependencies are required (refer to meson's output when configuring | ||
the build dir). | ||
|
||
.. code-block:: bash | ||
$ meson configure build_dir -Dconfig_tests=enabled | ||
$ ninja install -C build_dir | ||
$ meson test -C build_dir --suite config | ||
Integration tests | ||
================= | ||
----------------- | ||
|
||
The integration tests are using Deckard, the `DNS test harness <deckard>`_. The | ||
tests simulate specific DNS scenarios, including authoritative server and their | ||
responses. | ||
|
||
These tests require installed kresd. The binary ``kresd`` found in ``$PATH`` | ||
will be tested. When testing through meson, ``$PATH`` is modified automatically | ||
and you just need to make sure to install kresd first. | ||
|
||
To enable these tests, specify ``-Dextra_tests=enabled`` option for meson. | ||
Multiple dependencies are required (refer to meson's output when configuring | ||
the build dir). | ||
|
||
Enabling ``extra_tests`` automatically enables config tests as well. | ||
|
||
.. code-block:: bash | ||
$ meson configure build_dir -Dextra_tests=enabled | ||
$ ninja install -C build_dir | ||
$ meson test -C build_dir --suite integration | ||
Pytests | ||
------- | ||
|
||
The pytest suite is designed to spin up a kresd instance, acquire a connected | ||
socket, and then performs any tests on it. These tests are used to test for | ||
example TCP, TLS and its connection management. | ||
|
||
These tests require installed kresd. The binary ``kresd`` found in ``$PATH`` | ||
will be tested. When testing through meson, ``$PATH`` is modified automatically | ||
and you just need to make sure to install kresd first. | ||
|
||
The integration tests are using Deckard, the `DNS test harness <deckard>`_. | ||
It requires Jinja2_ and Python, `socket_wrapper`_, libfaketime_ are embedded in the build (cmake is required for `socket_wrapper`_). | ||
To enable these tests, specify ``-Dextra_tests=enabled`` option for meson. | ||
Multiple dependencies are required (refer to meson's output when configuring | ||
the build dir). | ||
|
||
Execute the tests by: | ||
Enabling ``extra_tests`` automatically enables config tests as well. | ||
|
||
.. code-block:: bash | ||
$ make check-integration | ||
$ meson configure build_dir -Dextra_tests=enabled | ||
$ ninja install -C build_dir | ||
$ meson test -C build_dir --suite pytests | ||
See deckard_ documentation on how to write additional tests. | ||
.. _cmocka: https://cmocka.org/ | ||
.. _`socket_wrapper`: https://cwrap.org/socket_wrapper.html | ||
.. _`libfaketime`: https://github.com/wolfcw/libfaketime | ||
.. _deckard: https://gitlab.nic.cz/knot/deckard |