# Test that the start command reports to the user that a node crashed, # and does not log the crashed node in the stats.log file. # Test that the start command can start a node in the crashed state, and # that it sends a crash report. Test that the start command returns nonzero # exit status when not all nodes start successfully. # # @TEST-EXEC: bash %INPUT # @TEST-EXEC: btest-diff start1.out # @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-status-output btest-diff status1.out # @TEST-EXEC: btest-diff start2.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 # start all nodes, and one will crash ! zeekctl start > start1.out 2> tmp.out cat tmp.out >> start1.out # the crashed node should not be logged as "started" in stats.log grep started $ZEEKCTL_INSTALL_PREFIX/spool/stats.log > tmp ! grep worker-1 tmp # verify that a node is in the crashed state ! zeekctl status > status1.out # this time we don't want it to crash rm -f $ZEEKCTL_INSTALL_PREFIX/zeekctltest.cfg # verify that no email has been sent test ! -e $ZEEKCTL_INSTALL_PREFIX/sendmail.out # try to start a node in the "crashed" state zeekctl start > start2.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