diff options
author | Oto Šťáva <oto.stava@nic.cz> | 2024-01-18 20:05:40 +0100 |
---|---|---|
committer | Oto Šťáva <oto.stava@nic.cz> | 2024-01-18 20:05:40 +0100 |
commit | 2e9fc7fb64544ab3f74fd69c3c88014561e55338 (patch) | |
tree | f63d0413041729d004b1121c07062912a57eeb83 | |
parent | Merge remote-tracking branch 'origin/master' into doc-logo-manual-colors-6 (diff) | |
download | knot-resolver-2e9fc7fb64544ab3f74fd69c3c88014561e55338.tar.xz knot-resolver-2e9fc7fb64544ab3f74fd69c3c88014561e55338.zip |
manager/tests/packaging: More verbose systemd_service tests
-rwxr-xr-x | manager/tests/packaging/interactive/etag.sh | 6 | ||||
-rwxr-xr-x | manager/tests/packaging/interactive/metrics.sh | 4 | ||||
-rwxr-xr-x | manager/tests/packaging/interactive/workers.sh | 16 | ||||
-rwxr-xr-x | manager/tests/packaging/systemd_service.sh | 14 |
4 files changed, 34 insertions, 6 deletions
diff --git a/manager/tests/packaging/interactive/etag.sh b/manager/tests/packaging/interactive/etag.sh index a4c49ed9..f14ef96a 100755 --- a/manager/tests/packaging/interactive/etag.sh +++ b/manager/tests/packaging/interactive/etag.sh @@ -4,7 +4,11 @@ set -e socket_opt="--unix-socket /var/run/knot-resolver/manager.sock" +echo " etag" etag="$(curl --silent $socket_opt --fail http://localhost:5000/v1/config -o /dev/null -v 2>&1 | grep ETag | sed 's/< ETag: //;s/\s//')" -status=$(curl --silent $socket_opt --fail http://localhost:5000/v1/config --header "If-None-Match: $etag" -w "%{http_code}" -o /dev/null) +echo " etag OK" +echo " status" +status=$(curl --silent $socket_opt --fail http://localhost:5000/v1/config --header "If-None-Match: $etag" -w "%{http_code}" -o /dev/null) test "$status" -eq 304 +echo " status OK" diff --git a/manager/tests/packaging/interactive/metrics.sh b/manager/tests/packaging/interactive/metrics.sh index a3e8748f..c7779e11 100755 --- a/manager/tests/packaging/interactive/metrics.sh +++ b/manager/tests/packaging/interactive/metrics.sh @@ -1,3 +1,5 @@ #!/bin/bash -curl --silent --fail --unix-socket /var/run/knot-resolver/manager.sock http://localhost/metrics > /dev/null
\ No newline at end of file +set -e + +curl --silent --fail --unix-socket /var/run/knot-resolver/manager.sock http://localhost/metrics > /dev/null diff --git a/manager/tests/packaging/interactive/workers.sh b/manager/tests/packaging/interactive/workers.sh index cef91b60..4f54f6ae 100755 --- a/manager/tests/packaging/interactive/workers.sh +++ b/manager/tests/packaging/interactive/workers.sh @@ -1,7 +1,17 @@ #!/bin/bash -set -e +expected_workers="5" -kresctl config set -p /workers 5 +kresctl config set -p /workers "$expected_workers" +if [ "$?" -ne "0" ]; then + echo "Could not configure $expected_workers workers" + exit 1 +fi -test "$(ps -a -x | grep kresd | grep -v grep | wc -l)" -eq 5 +actual_processes="$(pidof kresd | wc -w)" +if [ "$actual_processes" -ne "$expected_workers" ]; then + echo "Incorrect number of workers" + echo "(actual) != (expected)" + echo "$actual_processes != $expected_workers" + exit 1 +fi diff --git a/manager/tests/packaging/systemd_service.sh b/manager/tests/packaging/systemd_service.sh index 6e356f5e..24f48071 100755 --- a/manager/tests/packaging/systemd_service.sh +++ b/manager/tests/packaging/systemd_service.sh @@ -26,13 +26,25 @@ if ! systemctl start knot-resolver.service; then id knot-resolver exit 1 else + set +e + # check that the resolvers are actually running kdig @127.0.0.1 nic.cz + if [ "$?" -ne "0" ]; then + echo "Could not 'kdig' the resolvers - are they running?" + exit 1 + fi echo "Running interactive tests..." + exit_code="0" for test in "$(dirname $0)"/interactive/*; do echo "[test] $test" $test + if [ "$?" -ne "0" ]; then + echo "[test] $test FAILED" + exit_code="1" + fi + echo "[test] $test OK" done + exit "$exit_code" fi - |