Skip to content

Commit 714a070

Browse files
committed
fixup! manager: files: watchdog: added RPZ files
1 parent 504e92e commit 714a070

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

tests/packaging/interactive/rpz_watchdog.sh

+10-13
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ rpz_example=$(cat <<EOF
1010
ok.example.com CNAME rpz-passthru.
1111
EOF
1212
)
13-
1413
# create example RPZ
1514
echo "$rpz_example" >> $rpz_file
1615

@@ -21,14 +20,8 @@ local-data:
2120
watchdog: false
2221
EOF
2322
)
24-
25-
# configure RPZ file
23+
# add RPZ to config
2624
echo "$rpz_conf" >> /etc/knot-resolver/config.yaml
27-
kresctl reload
28-
if [ "$?" -ne "0" ]; then
29-
echo "Could not set RPZ."
30-
exit 1
31-
fi
3225

3326
function count_errors(){
3427
echo "$(journalctl -u knot-resolver.service | grep -c error)"
@@ -38,35 +31,39 @@ function count_reloads(){
3831
echo "$(journalctl -u knot-resolver.service | grep -c "Reloading policy rules has finished")"
3932
}
4033

41-
# test that RPZ watchdog is turned off
34+
# test that RPZ watchdog
4235
# {{
4336

4437
err_count=$(count_errors)
4538
rel_count=$(count_reloads)
4639

40+
# reload config with RPZ configured without watchdog turned on
41+
kresctl reload
42+
sleep 1
4743
if [ $(count_errors) -ne $err_count ] || [ $(count_reloads) -ne $rel_count ]; then
4844
echo "RPZ file watchdog is running (should not) or other errors occurred."
4945
exit 1
5046
fi
5147

52-
# }}
53-
5448
# configure RPZ file and turn on watchdog
5549
kresctl config set -p /local-data/rpz/0/watchdog true
50+
sleep 1
5651
if [ "$?" -ne "0" ]; then
5752
echo "Could not turn on RPZ file watchdog."
5853
exit 1
5954
fi
6055

61-
# test modification
56+
# }}
57+
58+
# test RPZ modification
6259
# {{
6360

6461
# modify RPZ file, it will trigger reload
6562
rel_count=$(count_reloads)
6663
echo "32.1.2.0.192.rpz-client-ip CNAME rpz-passthru." >> $rpz_file
6764

6865
# wait for files reload to finish
69-
sleep 10
66+
sleep 6
7067

7168
if [ $(count_errors) -ne $err_count ] || [ $(count_reloads) -eq $rel_count ]; then
7269
echo "Could not reload modified RPZ file."

0 commit comments

Comments
 (0)