]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: tests moved to the repository root
authorAleš Mrázek <ales.mrazek@nic.cz>
Fri, 21 Jun 2024 10:30:08 +0000 (12:30 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Mon, 26 Aug 2024 12:28:10 +0000 (14:28 +0200)
45 files changed:
distro/tests/extra/all/control
manager/pyproject.toml
manager/tests/README.md [deleted file]
manager/tests/packaging/control [deleted file]
tests/README.rst
tests/manager/__init__.py [moved from manager/tests/unit/__init__.py with 100% similarity]
tests/manager/datamodel/templates/test_cache_macros.py [moved from manager/tests/unit/datamodel/templates/test_cache_macros.py with 100% similarity]
tests/manager/datamodel/templates/test_common_macros.py [moved from manager/tests/unit/datamodel/templates/test_common_macros.py with 100% similarity]
tests/manager/datamodel/templates/test_forward_macros.py [moved from manager/tests/unit/datamodel/templates/test_forward_macros.py with 100% similarity]
tests/manager/datamodel/templates/test_network_macros.py [moved from manager/tests/unit/datamodel/templates/test_network_macros.py with 100% similarity]
tests/manager/datamodel/templates/test_policy_macros.py [moved from manager/tests/unit/datamodel/templates/test_policy_macros.py with 100% similarity]
tests/manager/datamodel/templates/test_types_render.py [moved from manager/tests/unit/datamodel/templates/test_types_render.py with 100% similarity]
tests/manager/datamodel/templates/test_view_macros.py [moved from manager/tests/unit/datamodel/templates/test_view_macros.py with 100% similarity]
tests/manager/datamodel/test_config_schema.py [moved from manager/tests/unit/datamodel/test_config_schema.py with 100% similarity]
tests/manager/datamodel/test_forward_schema.py [moved from manager/tests/unit/datamodel/test_forward_schema.py with 100% similarity]
tests/manager/datamodel/test_local_data.py [moved from manager/tests/unit/datamodel/test_local_data.py with 100% similarity]
tests/manager/datamodel/test_lua_schema.py [moved from manager/tests/unit/datamodel/test_lua_schema.py with 100% similarity]
tests/manager/datamodel/test_management_schema.py [moved from manager/tests/unit/datamodel/test_management_schema.py with 100% similarity]
tests/manager/datamodel/test_network_schema.py [moved from manager/tests/unit/datamodel/test_network_schema.py with 100% similarity]
tests/manager/datamodel/test_policy_schema.py [moved from manager/tests/unit/datamodel/test_policy_schema.py with 100% similarity]
tests/manager/datamodel/test_rpz_schema.py [moved from manager/tests/unit/datamodel/test_rpz_schema.py with 100% similarity]
tests/manager/datamodel/types/test_base_types.py [moved from manager/tests/unit/datamodel/types/test_base_types.py with 100% similarity]
tests/manager/datamodel/types/test_custom_types.py [moved from manager/tests/unit/datamodel/types/test_custom_types.py with 100% similarity]
tests/manager/datamodel/types/test_generic_types.py [moved from manager/tests/unit/datamodel/types/test_generic_types.py with 100% similarity]
tests/manager/test_config_store.py [moved from manager/tests/unit/test_config_store.py with 100% similarity]
tests/manager/test_knot_resolver_manager.py [moved from manager/tests/unit/test_knot_resolver_manager.py with 100% similarity]
tests/manager/utils/modeling/test_base_schema.py [moved from manager/tests/unit/utils/modeling/test_base_schema.py with 100% similarity]
tests/manager/utils/modeling/test_etag.py [moved from manager/tests/unit/utils/modeling/test_etag.py with 100% similarity]
tests/manager/utils/modeling/test_json_pointer.py [moved from manager/tests/unit/utils/modeling/test_json_pointer.py with 100% similarity]
tests/manager/utils/modeling/test_query.py [moved from manager/tests/unit/utils/modeling/test_query.py with 100% similarity]
tests/manager/utils/modeling/test_renaming.py [moved from manager/tests/unit/utils/modeling/test_renaming.py with 100% similarity]
tests/manager/utils/modeling/test_types.py [moved from manager/tests/unit/utils/modeling/test_types.py with 100% similarity]
tests/manager/utils/test_dataclasses.py [moved from manager/tests/unit/utils/test_dataclasses.py with 100% similarity]
tests/manager/utils/test_functional.py [moved from manager/tests/unit/utils/test_functional.py with 100% similarity]
tests/packaging/README.md [new file with mode: 0644]
tests/packaging/dependencies.py [moved from manager/tests/packaging/dependencies.py with 95% similarity]
tests/packaging/interactive/cache-clear.sh [moved from manager/tests/packaging/interactive/cache-clear.sh with 100% similarity]
tests/packaging/interactive/etag.sh [moved from manager/tests/packaging/interactive/etag.sh with 100% similarity]
tests/packaging/interactive/metrics.sh [moved from manager/tests/packaging/interactive/metrics.sh with 100% similarity]
tests/packaging/interactive/reload.sh [moved from manager/tests/packaging/interactive/reload.sh with 100% similarity]
tests/packaging/interactive/workers.sh [moved from manager/tests/packaging/interactive/workers.sh with 100% similarity]
tests/packaging/knot-resolver.sh [moved from manager/tests/packaging/knot-resolver.sh with 100% similarity]
tests/packaging/kresctl.sh [moved from manager/tests/packaging/kresctl.sh with 100% similarity]
tests/packaging/manpage.sh [moved from manager/tests/packaging/manpage.sh with 100% similarity]
tests/packaging/systemd_service.sh [moved from manager/tests/packaging/systemd_service.sh with 100% similarity]

index b13cc27d2e369b423ffb4cd5e03b03236137aab0..1130b04dc125e0327a7fe8a5fd8c375e822cd52f 100644 (file)
@@ -1,2 +1,41 @@
-{# 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 %}
index 7f1bde1f221c2624115150e0a91f41eff4be1c00..3f1cb4542f6db1e9dc34b1f5b382650ca3fe1b74 100644 (file)
@@ -62,7 +62,7 @@ configure = { cmd = "scripts/meson-configure", help = "Configure Knot Resolver d
 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"}
diff --git a/manager/tests/README.md b/manager/tests/README.md
deleted file mode 100644 (file)
index 1b6fc18..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# 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
diff --git a/manager/tests/packaging/control b/manager/tests/packaging/control
deleted file mode 100644 (file)
index 75c2709..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-{# 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 %}
index 37867b3890f27e75206ecbd690bd7037eb4d5a02..c2239f2fde0062835eeff330ec284ea7db57ac36 100644 (file)
@@ -1,13 +1,23 @@
 .. 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).
@@ -17,8 +27,9 @@ 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,
@@ -29,8 +40,9 @@ kresd first.
 
         $ 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.
@@ -45,8 +57,9 @@ the build dir).
         $ 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.
@@ -82,7 +95,7 @@ example TCP, TLS and its connection management.
         $ meson test -C build_dir --suite pytests
 
 Useful meson commands
----------------------
+=====================
 
 It's possible to run only specific test suite or a test.
 
diff --git a/tests/packaging/README.md b/tests/packaging/README.md
new file mode 100644 (file)
index 0000000..633bd57
--- /dev/null
@@ -0,0 +1,5 @@
+# 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.
similarity index 95%
rename from manager/tests/packaging/dependencies.py
rename to tests/packaging/dependencies.py
index d92be71a989c9ab4439ffab508d1216f1ca7b902..324ff30b4a8642054aeb70d1c72b6a1282b9cb4e 100755 (executable)
@@ -15,7 +15,7 @@ sys.modules["setuptools"] = dummy
 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