]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
repository cleanup
authorVasek Sraier <git@vakabus.cz>
Thu, 18 Nov 2021 16:44:03 +0000 (17:44 +0100)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 8 Apr 2022 14:17:53 +0000 (16:17 +0200)
- unified all tests under tests/ directory
- removed unused distro/

28 files changed:
manager/distro/README.md [deleted file]
manager/distro/config/apkg.toml [deleted file]
manager/distro/pkg/deb/changelog [deleted file]
manager/distro/pkg/deb/compat [deleted file]
manager/distro/pkg/deb/control [deleted file]
manager/distro/pkg/deb/copyright [deleted file]
manager/distro/pkg/deb/rules [deleted file]
manager/distro/pkg/deb/source/format [deleted file]
manager/integration/run/.gitkeep [deleted file]
manager/pyproject.toml
manager/scripts/codecheck
manager/scripts/make-package.sh
manager/tests/README.md [new file with mode: 0644]
manager/tests/integration/.gitignore [moved from manager/integration/.gitignore with 100% similarity]
manager/tests/integration/config.yml [moved from manager/integration/config.yml with 86% similarity]
manager/tests/integration/runner.py [moved from manager/integration/runner.py with 88% similarity]
manager/tests/unit/__init__.py [moved from manager/tests/__init__.py with 100% similarity]
manager/tests/unit/datamodel/test_config_schema.py [moved from manager/tests/datamodel/test_config_schema.py with 100% similarity]
manager/tests/unit/datamodel/test_datamodel_types.py [moved from manager/tests/datamodel/test_datamodel_types.py with 100% similarity]
manager/tests/unit/datamodel/test_lua_schema.py [moved from manager/tests/datamodel/test_lua_schema.py with 100% similarity]
manager/tests/unit/datamodel/test_network_schema.py [moved from manager/tests/datamodel/test_network_schema.py with 100% similarity]
manager/tests/unit/datamodel/test_options_schema.py [moved from manager/tests/datamodel/test_options_schema.py with 100% similarity]
manager/tests/unit/test_knot_resolver_manager.py [moved from manager/tests/test_knot_resolver_manager.py with 100% similarity]
manager/tests/unit/utils/test_dataclasses.py [moved from manager/tests/utils/test_dataclasses.py with 100% similarity]
manager/tests/unit/utils/test_functional.py [moved from manager/tests/utils/test_functional.py with 100% similarity]
manager/tests/unit/utils/test_modeling.py [moved from manager/tests/utils/test_modeling.py with 100% similarity]
manager/tests/unit/utils/test_overloaded.py [moved from manager/tests/utils/test_overloaded.py with 100% similarity]
manager/tests/unit/utils/test_types.py [moved from manager/tests/utils/test_types.py with 100% similarity]

diff --git a/manager/distro/README.md b/manager/distro/README.md
deleted file mode 100644 (file)
index 91e03bd..0000000
+++ /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 (file)
index ea8cd09..0000000
+++ /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 (file)
index 80c5d4f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-knot-resolver-manager ({{ version }}-cznic.{{ release }}) unstable; urgency=medium
-
-  * new upstream version {{ version }}
-
- -- Jakub Ružička <jakub.ruzicka@nic.cz>  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 (file)
index ec63514..0000000
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/manager/distro/pkg/deb/control b/manager/distro/pkg/deb/control
deleted file mode 100644 (file)
index c79d199..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-Source: knot-resolver-manager
-Section: python
-Priority: optional
-Maintainer: Jakub Ružička <jakub.ruzicka@nic.cz>
-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 (file)
index bae0f28..0000000
+++ /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 <https://www.gnu.org/licenses/>.
- .
- 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 (executable)
index 570efe9..0000000
+++ /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 (file)
index 163aaf8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/manager/integration/run/.gitkeep b/manager/integration/run/.gitkeep
deleted file mode 100644 (file)
index e69de29..0000000
index 748e936306a251e454a07b8efaa6c3fb4e249764..baa4fbd778e6d4db9537551f0de2cc3d40e61665 100644 (file)
@@ -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" }
 
 
index ea9c7d984597cfa1bbdac14e6aaa65bdded8d24f..9556ae050bad5e94499279bd69cea049817053e7 100755 (executable)
@@ -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
 
index d441a499556d5cf4ef0ac2c8e15ad4990316f0ed..1a7ffa6f526fdc4b7617b5b4b8e363dedf897b5b 100644 (file)
@@ -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 (file)
index 0000000..1b6fc18
--- /dev/null
@@ -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
similarity index 86%
rename from manager/integration/config.yml
rename to manager/tests/integration/config.yml
index c1b39309bd40d884f814a174409f4a27196804cc..5fe8f8a2499ce524a4911a35e13f4298967eeb71 100644 (file)
@@ -9,7 +9,7 @@ server:
     listen:
       ip: 127.0.0.1
       port: 5001
-    rundir: integration/run
+    rundir: tests/integration/run
 cache:
   storage: cache
 logging:
similarity index 88%
rename from manager/integration/runner.py
rename to manager/tests/integration/runner.py
index 45b2111e35720971877db11f513bea95fa4c61c0..f4ea0f26bbeefb4c6a268ce9acea230a589b6463 100644 (file)
@@ -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))