# Test that the stop command can cleanup a crashed node (including resetting # its state to "stopped") and sends a crash report, and does not log the # crashed node in the stats.log file. # # @TEST-EXEC: bash %INPUT # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-status-output btest-diff status1.out # @TEST-EXEC: btest-diff stop.out # @TEST-EXEC: 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 # the start command creates some files (these are NOT created by zeek itself) while read line; do test -e $ZEEKCTL_INSTALL_PREFIX/$line done << EOF spool/worker-1/.cmdline spool/worker-1/.env_vars spool/worker-1/.pid spool/worker-1/.startup spool/worker-1/stderr.log spool/worker-1/stdout.log EOF # verify that a node crashed ! zeekctl status > status1.out # verify that no email has been sent test ! -e $ZEEKCTL_INSTALL_PREFIX/sendmail.out # test the stop command zeekctl stop > stop.out # the stop command should cleanup the crashed node directory while read line; do test ! -e $ZEEKCTL_INSTALL_PREFIX/$line done << EOF spool/worker-1/.cmdline spool/worker-1/.env_vars spool/worker-1/.pid spool/worker-1/.startup spool/worker-1/stderr.log spool/worker-1/stdout.log EOF # the crashed node should not be logged as "stopped" in stats.log grep stopped $ZEEKCTL_INSTALL_PREFIX/spool/stats.log > tmp ! grep worker-1 tmp # verify that a crash report was sent grep -q "Crash report from worker-1" $ZEEKCTL_INSTALL_PREFIX/sendmail.out # verify that all nodes are in the stopped state ! zeekctl status > status2.out