zeek/auxil/zeekctl/testing/command/restart-crash.test
Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

45 lines
1.1 KiB
Plaintext

# Test that the restart command can restart crashed nodes and that a crash
# report is sent.
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-status-output btest-diff status1.out
# @TEST-EXEC: btest-diff restart.out
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-status-output btest-diff status2.out
. zeekctl-test-setup
while read line; do installfile $line; done << EOF
etc/zeekctl.cfg__test_sendmail
etc/node.cfg__cluster
bin/zeek__test
bin/sendmail__test --new
EOF
replaceprefix etc/zeekctl.cfg
cat > $ZEEKCTL_INSTALL_PREFIX/zeekctltest.cfg << EOF
crash=worker-1
EOF
zeekctl install
! zeekctl start
# when we restart, make sure no nodes crash
rm $ZEEKCTL_INSTALL_PREFIX/zeekctltest.cfg
# verify that a node crashed
! zeekctl status > status1.out
# verify that no email has been sent
test ! -e $ZEEKCTL_INSTALL_PREFIX/sendmail.out
zeekctl restart > restart.out
# verify that a crash report was sent
grep -q "Crash report from worker-1" $ZEEKCTL_INSTALL_PREFIX/sendmail.out
# verify that all nodes are running
zeekctl status > status2.out
zeekctl stop