-{# This adds all tests for manager's packaging #}
-{% include 'manager/tests/packaging/control' %}
+{# Test that all packages are installed #}
+Tests: dependencies.py
+Tests-Directory: tests/packaging/
+
+
+{# Test that kresctl command exists and is in $PATH #}
+Tests: kresctl.sh
+Tests-Directory: tests/packaging
+
+
+{# Test that knot-resolver command exists and is in $PATH #}
+Tests: knot-resolver.sh
+Tests-Directory: tests/packaging
+
+
+{# Tests that the manager can be started with default config and it resolves some domains #}
+Tests: systemd_service.sh
+Tests-Directory: tests/packaging
+Restrictions: needs-root
+{% if distro.match('fedora') -%}
+Depends: knot-utils, jq, curl, procps
+{% elif distro.match('debian') or distro.match('ubuntu') -%}
+Depends: knot-dnsutils, jq, curl, procps
+{% elif distro.match('arch') -%}
+Depends: knot, jq, curl
+{% elif distro.match('rocky', 'centos') -%}
+Depends: knot-utils, jq, curl
+{% elif distro.match('almalinux') -%}
+Depends: knot-utils, jq, curl-minimal, procps
+{% elif distro.match('opensuse') -%}
+Depends: knot-utils, jq, curl
+{% else -%}
+Depends: unsupported-distro-this-package-does-not-exist-and-the-test-should-fail
+{%- endif %}
+
+
+Tests: manpage.sh
+Tests-Directory: tests/packaging
+{% if distro.match('fedora') or distro.match('rocky') or distro.match('opensuse') -%}
+Depends: man
+{%- endif %}
run = { cmd = "scripts/run", help = "Run the manager" }
run-debug = { cmd = "scripts/run-debug", help = "Run the manager under debugger" }
docs = { cmd = "scripts/docs", help = "Create HTML documentation" }
-test = { shell = "env PYTHONPATH=. pytest --junitxml=unit.junit.xml --cov=knot_resolver_manager --show-capture=all tests/unit/", help = "Run tests" }
+test = { shell = "env PYTHONPATH=. pytest --junitxml=unit.junit.xml --cov=knot_resolver_manager --show-capture=all ../tests/manager", help = "Run tests" }
check = { cmd = "scripts/codecheck", help = "Run static code analysis" }
format = { shell = "black knot_resolver_manager/ tests/ scripts/ build_c_extensions.py; isort .", help = "Run code formatter" }
fixdeps = { shell = "poetry install; npm install; npm update", help = "Install/update dependencies according to configuration files"}
+++ /dev/null
-# Testing infrastructure
-
-## Unit tests
-
-The unit tests use `pytest` and can be invoked by the command `poe test`. They reside in the `unit` subdirectory. They can be run from freshly cloned repository and they should suceed.
-
-## Integration tests
-
-The integration tests spawn a full manager with `kresd` instances (which it expects to be installed). The tests are implemented by a custom script and they can be invoked by `poe integration` command.
\ No newline at end of file
+++ /dev/null
-{# Test that all packages are installed #}
-Tests: dependencies.py
-Tests-Directory: manager/tests/packaging/
-
-
-{# Test that kresctl command exists and is in $PATH #}
-Tests: kresctl.sh
-Tests-Directory: manager/tests/packaging
-
-
-{# Test that knot-resolver command exists and is in $PATH #}
-Tests: knot-resolver.sh
-Tests-Directory: manager/tests/packaging
-
-
-{# Tests that manager can be started with default config and it resolves some domains #}
-Tests: systemd_service.sh
-Tests-Directory: manager/tests/packaging
-Restrictions: needs-root
-{% if distro.match('fedora') -%}
-Depends: knot-utils, jq, curl, procps
-{% elif distro.match('debian') or distro.match('ubuntu') -%}
-Depends: knot-dnsutils, jq, curl, procps
-{% elif distro.match('arch') -%}
-Depends: knot, jq, curl
-{% elif distro.match('rocky', 'centos') -%}
-Depends: knot-utils, jq, curl
-{% elif distro.match('almalinux') -%}
-Depends: knot-utils, jq, curl-minimal, procps
-{% elif distro.match('opensuse') -%}
-Depends: knot-utils, jq, curl
-{% else -%}
-Depends: unsupported-distro-this-package-does-not-exist-and-the-test-should-fail
-{%- endif %}
-
-
-Tests: manpage.sh
-Tests-Directory: manager/tests/packaging
-{% if distro.match('fedora') or distro.match('rocky') or distro.match('opensuse') -%}
-Depends: man
-{%- endif %}
.. SPDX-License-Identifier: GPL-3.0-or-later
-Tests
-=====
+**********************
+Testing infrastructure
+**********************
+
+The following is a non-exhaustive list of various tests that can be found in this repo.
+Some can be enabled by meson build system and some can be performed by Poetry tool.
+
+
+The manager unit tests
+======================
+
+The unit tests use ``pytest`` and can be run with the command ``poe test``.
+They can be run from a freshly cloned repository and should be successful.
+They are located in the ``manager`` subdirectory.
-The following is a non-comprehensitve lists of various tests that can be found
-in this repo. These can be enabled by the build system.
Unit tests
-----------
+==========
The unit tests depend on cmocka_ and can easily be executed after compilation.
They are enabled by default (if ``cmocka`` is found).
$ ninja -C build_dir
$ meson test -C build_dir --suite unit
+
Postinstall tests
------------------
+=================
There following tests require a working installation of kresd. The
binary ``kresd`` found in ``$PATH`` will be tested. When testing through meson,
$ ninja install -C build_dir
+
Config tests
-------------
+============
Config tests utilize the kresd's lua config file to execute arbitrary tests,
typically testing various modules, their API etc.
$ ninja install -C build_dir
$ meson test -C build_dir --suite config
+
Extra tests
------------
+===========
The extra tests require a large set of additional dependencies and executing
them outside of upstream development is probably redundant.
$ meson test -C build_dir --suite pytests
Useful meson commands
----------------------
+=====================
It's possible to run only specific test suite or a test.
--- /dev/null
+# Packaging tests
+
+## Distro tests
+
+Tests in this directory are part of the distro tests included in the `distro/tests/extra/all/control` file and can be run with the `apkg test` command.
sys.modules["build_c_extensions"] = dummy
# load install_requires array from setup.py
-spec = importlib.util.spec_from_file_location("setup", sys.argv[1] if len(sys.argv) == 2 else "manager/setup.py")
+spec = importlib.util.spec_from_file_location("setup", sys.argv[1] if len(sys.argv) == 2 else "setup.py")
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
install_requires = mod.install_requires