File: cron-restart-crash.test

package info (click to toggle)
broctl 1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 2,220 kB
  • sloc: python: 4,931; sh: 1,188; makefile: 70; awk: 24
file content (48 lines) | stat: -rw-r--r-- 1,092 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Test that the cron command restarts a crashed node and sends a crash report,
# unless the "--no-watch" option is specified.
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-status-output btest-diff status1.out
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-status-output btest-diff status2.out

. broctl-test-setup

while read line; do installcfgfile "$line"; done << EOF
etc/broctl.cfg__test_sendmail
etc/node.cfg__cluster
bin/bro__test
bin/sendmail__test --new
EOF

replaceprefix etc/broctl.cfg

cat > $BROCTL_INSTALL_PREFIX/broctltest.cfg << EOF
crash=worker-1
EOF

ret=0
broctl install
broctl start

# make sure cron can restart the crashed node
rm -f $BROCTL_INSTALL_PREFIX/broctltest.cfg

# test with the "--no-watch" option
broctl cron --no-watch

broctl status > status1.out 2>&1

rm $BROCTL_INSTALL_PREFIX/sendmail.out

# test without the "--no-watch" option
broctl cron

# verify that a crash report was sent
grep -q "Crash report from worker-1" $BROCTL_INSTALL_PREFIX/sendmail.out || ret=1

broctl status > status2.out 2>&1

broctl stop

exit $ret