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"
#!/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
#!/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
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
-