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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
# Test the diag command.
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-diag-output btest-diff standalone
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-diag-output btest-diff cluster
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-diag-output btest-diff onenode
. zeekctl-test-setup
remove_errmsg() {
fname=$1
os=`uname`
# On FreeBSD, "ulimit -d unlimited" always fails for non-root users, so
# we need to filter out that error message.
if [ "$os" = "FreeBSD" ]; then
grep -v "ulimit: data seg size: cannot modify limit" $fname > $fname.2
mv $fname.2 $fname
fi
# On OpenBSD, "ulimit -d unlimited" and "ulimit -m unlimited" always fail
# for non-root users. So we need to filter out those error messages.
if [ "$os" = "OpenBSD" ]; then
grep -v "ulimit: [a-z ]*: cannot modify limit" $fname > $fname.2
mv $fname.2 $fname
fi
}
### Test using a standalone config
while read line; do installfile $line; done << EOF
etc/zeekctl.cfg__no_email
bin/zeek__test
EOF
zeekctl install
zeekctl start
zeekctl diag > standalone
zeekctl stop
remove_errmsg standalone
### Test using a cluster config
while read line; do installfile $line; done << EOF
etc/node.cfg__cluster
EOF
zeekctl install
zeekctl start
# output diags for all nodes
zeekctl diag > cluster
# output diags for one node
zeekctl diag worker-2 > onenode
zeekctl stop
remove_errmsg cluster
remove_errmsg onenode
|