]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
WIP: packaing tests using apkg's new test feature
authorVasek Sraier <git@vakabus.cz>
Tue, 17 May 2022 09:34:46 +0000 (11:34 +0200)
committerVasek Sraier <git@vakabus.cz>
Tue, 17 May 2022 09:34:46 +0000 (11:34 +0200)
ci/pkgtest.yaml
distro/tests/extra/all/control [new file with mode: 0644]
distro/tests/manager-packaging/control [new file with mode: 0644]
manager/scripts/make-package.sh
manager/tests/packaging/kresctl.sh [changed mode: 0644->0755]
manager/tests/packaging/systemd_service.sh [changed mode: 0644->0755]

index 955d64c1eb3f5281c867071457b50acd0365a881..8b55b903d6aac157c6a84afe7ac894d24bfeaf2a 100644 (file)
@@ -20,8 +20,14 @@ stages:
     paths:
       - pkg/
 
-.apkgbuild: &apkgbuild # new jinja2 breaks docs (sphinx/breathe)
-  - pip3 install -U apkg 'jinja2<3.1'
+.apkginstall: &apkginstall  # new jinja2 breaks docs (sphinx/breathe)
+  - git clone https://gitlab.nic.cz/packaging/apkg.git
+  - cd apkg; git checkout test; pip3 install -U . 'jinja2<3.1'
+  # - pip3 install -U . 'jinja2<3.1'
+  
+
+.apkgbuild: &apkgbuild
+  - *apkginstall
   - apkg build-dep -y
   - apkg build
 
@@ -170,13 +176,10 @@ nixos-unstable:pkgbuild:
 
 .debpkgtest: &debpkgtest
   - *pkgdebrepo
-  - apt-get install -y knot-dnsutils
   - apt-get install -y $(find ./pkg/pkgs -name '*.deb' | grep -v module | grep -v debug | grep -v devel)
-  - systemctl start kresd@1
-  - kdig @127.0.0.1 nic.cz | grep -qi NOERROR
-  - systemctl stop kresd@1
-  - systemctl start knot-resolver
-  - kdig @127.0.0.1 nic.cz | grep -qi NOERROR
+  - *apkginstall
+  - apkg test-dep
+  - apkg test
 
 centos-7:pkgtest:
   <<: *pkgtest
diff --git a/distro/tests/extra/all/control b/distro/tests/extra/all/control
new file mode 100644 (file)
index 0000000..e77964d
--- /dev/null
@@ -0,0 +1,2 @@
+{# This adds all tests for manager's packaging #}
+{% include 'distro/tests/manager-packaging/control' %}
diff --git a/distro/tests/manager-packaging/control b/distro/tests/manager-packaging/control
new file mode 100644 (file)
index 0000000..a86109e
--- /dev/null
@@ -0,0 +1,15 @@
+{# Test that kresctl command exists and is in $PATH #}
+Test-Command: bash manager/tests/packaging/kresctl.sh
+
+
+{# Tests that manager can be started with default config and it resolves some domains #}
+Test-Command: bash manager/tests/packaging/systemd_service.sh
+{% if distro.match('fedora') -%}
+Depends: knot-utils
+{% elif distro.match('debian') -%}
+Depends: knot-dnsutils
+{% elif distro.match('arch') -%}
+Depends: knot
+{% else -%}
+error this should fail
+{%- endif %}
index 60cf2fad755805d36e09b673ed2ead2ae1c9347a..85549e65f8165e53d5baa426288d308ff107ab46 100644 (file)
@@ -3,6 +3,16 @@
 set -o errexit
 set -o nounset
 
+function install_pipx {
+       python3 -m pip install --user pipx
+       python3 -m pipx ensurepath
+       export PATH="$PATH:/root/.local/bin"  # hack to make binaries installed with pipx work
+}
+
+function pipx {
+       python3 -m pipx ${@}
+}
+
 function init_debian {
     export DEBIAN_FRONTEND=noninteractive
 
@@ -38,10 +48,8 @@ else
 fi
 
 # install apkg
-python3 -m pip install --user pipx
-python3 -m pipx ensurepath
-PATH="$PATH:/root/.local/bin"  # hack to make binaries installed with pipx work
-python3 -m pipx install apkg
+install_pipx
+pipx install apkg
 
 # prepare the repo
 #git clone https://gitlab.nic.cz/knot/knot-resolver
old mode 100644 (file)
new mode 100755 (executable)
index 48fca73..579f1a1
@@ -4,4 +4,4 @@
 set -e
 
 # We expect `kresctl` command to exist in $PATH
-command -q -v kresctl
\ No newline at end of file
+command -v kresctl > /dev/null
old mode 100644 (file)
new mode 100755 (executable)
index 2afb5f8..3719ff1
@@ -10,7 +10,8 @@ if test "$(id -u)" -ne 0; then
 fi
 
 
+trap "systemctl stop knot-resolver.service" EXIT
 systemctl start knot-resolver.service
 
 # check that the resolvers are actually running
-kdig @127.0.0.1 nic.cz
\ No newline at end of file
+kdig @127.0.0.1 nic.cz