From: Vasek Sraier Date: Thu, 18 Nov 2021 16:44:03 +0000 (+0100) Subject: repository cleanup X-Git-Tag: v6.0.0a1~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b566fb5a78a5edfe4f4e68d4402c603b8d4696c8;p=thirdparty%2Fknot-resolver.git repository cleanup - unified all tests under tests/ directory - removed unused distro/ --- diff --git a/manager/distro/README.md b/manager/distro/README.md deleted file mode 100644 index 91e03bd51..000000000 --- a/manager/distro/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# knot-resolver-manager upstream packaging sources - -Top level distro/ dir contains upstream packaging sources for native packages. - -Files in this directory follow [apkg] conventions and apkg can be used to -create BIRD packages for various distros directly from upstream sources as -well as from upstream archives once available. - -[apkg]: https://apkg.rtfd.io - - -## Create package from current repo commit - -Create native packages using isolated builder (pbuilder, mock, ...): - - apkg build - -If you're using VM, container or other disposable system, it's recommended to -build packages directly using -h/--host-build and -i/--install-dep: - - apkg build -Hi - -To create source package: - - apkg srcpkg - diff --git a/manager/distro/config/apkg.toml b/manager/distro/config/apkg.toml deleted file mode 100644 index ea8cd0950..000000000 --- a/manager/distro/config/apkg.toml +++ /dev/null @@ -1,4 +0,0 @@ -[project] -name = "knot-resolver-manager" -# needed for make-archive -make_archive_script = "scripts/make-dev-archive.sh" diff --git a/manager/distro/pkg/deb/changelog b/manager/distro/pkg/deb/changelog deleted file mode 100644 index 80c5d4f03..000000000 --- a/manager/distro/pkg/deb/changelog +++ /dev/null @@ -1,5 +0,0 @@ -knot-resolver-manager ({{ version }}-cznic.{{ release }}) unstable; urgency=medium - - * new upstream version {{ version }} - - -- Jakub Ružička Tue, 20 Apr 2020 16:20:00 +0100 diff --git a/manager/distro/pkg/deb/compat b/manager/distro/pkg/deb/compat deleted file mode 100644 index ec635144f..000000000 --- a/manager/distro/pkg/deb/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/manager/distro/pkg/deb/control b/manager/distro/pkg/deb/control deleted file mode 100644 index c79d199a3..000000000 --- a/manager/distro/pkg/deb/control +++ /dev/null @@ -1,24 +0,0 @@ -Source: knot-resolver-manager -Section: python -Priority: optional -Maintainer: Jakub Ružička -Build-Depends: - debhelper, - dh-python, - python3, -Homepage: https://gitlab.nic.cz/knot/knot-resolver-manager - -Package: python3-knot-resolver-manager -Architecture: all -Depends: - python3-aiohttp, - python3-click, - python3-gi, - python3-pydbus, - python3-yaml, - ${misc:Depends}, - ${python3:Depends}, -Recommends: - knot-resolver -Provides: knot-resolver-manager -Description: Knot Resolver Manager diff --git a/manager/distro/pkg/deb/copyright b/manager/distro/pkg/deb/copyright deleted file mode 100644 index bae0f2875..000000000 --- a/manager/distro/pkg/deb/copyright +++ /dev/null @@ -1,24 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: knot-resolver-manager -Source: https://gitlab.nic.cz/knot/knot-resolver-manager - -Files: * -Copyright: (c) 2021, CZ.NIC -License: GPL-3+ - -License: GPL-3+ - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - . - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this program. If not, see . - . - On Debian systems, the full text of the GNU General Public License - version 3 can be found in the file `/usr/share/common-licenses/GPL-3'. diff --git a/manager/distro/pkg/deb/rules b/manager/distro/pkg/deb/rules deleted file mode 100755 index 570efe976..000000000 --- a/manager/distro/pkg/deb/rules +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/make -f - -%: - dh $@ --buildsystem=pybuild - -override_dh_auto_build: - echo "no build required" diff --git a/manager/distro/pkg/deb/source/format b/manager/distro/pkg/deb/source/format deleted file mode 100644 index 163aaf8d8..000000000 --- a/manager/distro/pkg/deb/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/manager/integration/run/.gitkeep b/manager/integration/run/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/manager/pyproject.toml b/manager/pyproject.toml index 748e93630..baa4fbd77 100644 --- a/manager/pyproject.toml +++ b/manager/pyproject.toml @@ -39,9 +39,9 @@ pylint = "^2.11.1" 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 = { cmd = "pytest --cov=knot_resolver_manager --show-capture=all tests/", help = "Run tests" } +test = { cmd = "pytest --cov=knot_resolver_manager --show-capture=all tests/unit/", help = "Run tests" } check = { cmd = "scripts/codecheck", help = "Run static code analysis" } -format = { shell = "black knot_resolver_manager/ tests/ integration/ scripts/; isort .", help = "Run code formatter" } +format = { shell = "black knot_resolver_manager/ tests/ scripts/; isort .", help = "Run code formatter" } fixdeps = { shell = "poetry install; npm install; npm update", help = "Install/update dependencies according to configuration files"} commit = { shell = "scripts/commit", help = "Invoke every single check before commiting" } container = { cmd = "scripts/container.py", help = "Manage containers" } @@ -56,7 +56,7 @@ clean = """ """ gen-setuppy = { shell = "python scripts/create_setup.py > setup.py", help = "Generate setup.py file for backwards compatibility" } tox = { cmd = "tox", help = "Run tests in tox" } -integration = {cmd = "python integration/runner.py", help = "Run integration tests" } +integration = {cmd = "python tests/integration/runner.py", help = "Run integration tests" } configure-vscode = {cmd = "scripts/configure-vscode", help = "Create VSCode configuration for debugging, virtual envs etc" } diff --git a/manager/scripts/codecheck b/manager/scripts/codecheck index ea9c7d984..9556ae050 100755 --- a/manager/scripts/codecheck +++ b/manager/scripts/codecheck @@ -18,7 +18,7 @@ set +e # check formatting using black echo -e "${yellow}Checking formatting using black...${reset}" -black knot_resolver_manager tests integration scripts --check --diff +black knot_resolver_manager tests scripts --check --diff check_rv $? echo diff --git a/manager/scripts/make-package.sh b/manager/scripts/make-package.sh index d441a4995..1a7ffa6f5 100644 --- a/manager/scripts/make-package.sh +++ b/manager/scripts/make-package.sh @@ -47,6 +47,10 @@ git config --global user.email "ci@knot-resolver" git config --global user.name "GitLab CI" git checkout manager-integration git submodule update --init --recursive +cd manager +git checkout master +cd .. +git commit -a -m "auto-update of knot-resolver's manager to the latest master branch" # build the package apkg system-setup diff --git a/manager/tests/README.md b/manager/tests/README.md new file mode 100644 index 000000000..1b6fc185e --- /dev/null +++ b/manager/tests/README.md @@ -0,0 +1,9 @@ +# 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/integration/.gitignore b/manager/tests/integration/.gitignore similarity index 100% rename from manager/integration/.gitignore rename to manager/tests/integration/.gitignore diff --git a/manager/integration/config.yml b/manager/tests/integration/config.yml similarity index 86% rename from manager/integration/config.yml rename to manager/tests/integration/config.yml index c1b39309b..5fe8f8a24 100644 --- a/manager/integration/config.yml +++ b/manager/tests/integration/config.yml @@ -9,7 +9,7 @@ server: listen: ip: 127.0.0.1 port: 5001 - rundir: integration/run + rundir: tests/integration/run cache: storage: cache logging: diff --git a/manager/integration/runner.py b/manager/tests/integration/runner.py similarity index 88% rename from manager/integration/runner.py rename to manager/tests/integration/runner.py index 45b2111e3..f4ea0f26b 100644 --- a/manager/integration/runner.py +++ b/manager/tests/integration/runner.py @@ -17,7 +17,7 @@ logger = logging.getLogger(__name__) def test_wrapper(test: Test) -> bool: - p = start_manager_in_background(Path("integration/config.yml")) + p = start_manager_in_background(Path("tests/integration/config.yml")) client = KnotManagerClient(BASE_URL) client.wait_for_initialization() @@ -64,7 +64,7 @@ def crash_resistance(client: KnotManagerClient): assert cnt == 2, f"Expected 2 kresd instances, found {cnt}" # start the server again - p = start_manager_in_background(Path("integration/config.yml")) + p = start_manager_in_background(Path("test/integration/config.yml")) try: client.wait_for_initialization() except TimeoutError as e: @@ -83,7 +83,14 @@ def crash_resistance(client: KnotManagerClient): if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) + + # create run directories if it does not exist + Path("tests/integration/run").mkdir(exist_ok=True) + + # run the tests success = True success &= test_wrapper(worker_count) # success &= test_wrapper(crash_resistance) + + # exit with proper exitcode sys.exit(int(not success)) diff --git a/manager/tests/__init__.py b/manager/tests/unit/__init__.py similarity index 100% rename from manager/tests/__init__.py rename to manager/tests/unit/__init__.py diff --git a/manager/tests/datamodel/test_config_schema.py b/manager/tests/unit/datamodel/test_config_schema.py similarity index 100% rename from manager/tests/datamodel/test_config_schema.py rename to manager/tests/unit/datamodel/test_config_schema.py diff --git a/manager/tests/datamodel/test_datamodel_types.py b/manager/tests/unit/datamodel/test_datamodel_types.py similarity index 100% rename from manager/tests/datamodel/test_datamodel_types.py rename to manager/tests/unit/datamodel/test_datamodel_types.py diff --git a/manager/tests/datamodel/test_lua_schema.py b/manager/tests/unit/datamodel/test_lua_schema.py similarity index 100% rename from manager/tests/datamodel/test_lua_schema.py rename to manager/tests/unit/datamodel/test_lua_schema.py diff --git a/manager/tests/datamodel/test_network_schema.py b/manager/tests/unit/datamodel/test_network_schema.py similarity index 100% rename from manager/tests/datamodel/test_network_schema.py rename to manager/tests/unit/datamodel/test_network_schema.py diff --git a/manager/tests/datamodel/test_options_schema.py b/manager/tests/unit/datamodel/test_options_schema.py similarity index 100% rename from manager/tests/datamodel/test_options_schema.py rename to manager/tests/unit/datamodel/test_options_schema.py diff --git a/manager/tests/test_knot_resolver_manager.py b/manager/tests/unit/test_knot_resolver_manager.py similarity index 100% rename from manager/tests/test_knot_resolver_manager.py rename to manager/tests/unit/test_knot_resolver_manager.py diff --git a/manager/tests/utils/test_dataclasses.py b/manager/tests/unit/utils/test_dataclasses.py similarity index 100% rename from manager/tests/utils/test_dataclasses.py rename to manager/tests/unit/utils/test_dataclasses.py diff --git a/manager/tests/utils/test_functional.py b/manager/tests/unit/utils/test_functional.py similarity index 100% rename from manager/tests/utils/test_functional.py rename to manager/tests/unit/utils/test_functional.py diff --git a/manager/tests/utils/test_modeling.py b/manager/tests/unit/utils/test_modeling.py similarity index 100% rename from manager/tests/utils/test_modeling.py rename to manager/tests/unit/utils/test_modeling.py diff --git a/manager/tests/utils/test_overloaded.py b/manager/tests/unit/utils/test_overloaded.py similarity index 100% rename from manager/tests/utils/test_overloaded.py rename to manager/tests/unit/utils/test_overloaded.py diff --git a/manager/tests/utils/test_types.py b/manager/tests/unit/utils/test_types.py similarity index 100% rename from manager/tests/utils/test_types.py rename to manager/tests/unit/utils/test_types.py