Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

37 lines
1.5 KiB
Plaintext

# Test that the scripts command can output contents of loaded_scripts.log
# on all nodes, or just a specified node.
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-timestamps-yyyy-mm-dd-hh-mm-ss btest-diff all.out
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-timestamps-yyyy-mm-dd-hh-mm-ss btest-diff onenode.out
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-timestamps-yyyy-mm-dd-hh-mm-ss btest-diff c-all.out
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-timestamps-yyyy-mm-dd-hh-mm-ss btest-diff c-onenode.out
. zeekctl-test-setup
while read line; do installfile $line; done << EOF
etc/node.cfg__cluster
EOF
# replace one or more continuous lines of absolute paths with one line of text,
# and ignore lines with "processing suspended" or "processing continued"
rmpaths='awk "{ if(\$1 ~ /\/.*/) { if(p==0) { print \"<...paths...>\"; p=1; } } else { p=0; if(\$1 != \"processing\" ) { print; } } }"'
zeekctl install
# show loaded_scripts.log for all nodes
zeekctl scripts > tmp1.out
eval ${rmpaths} tmp1.out | grep -v rotate_file_by_name > all.out
# show loaded_scripts.log for one node
zeekctl scripts worker-1 > tmp2.out
eval ${rmpaths} tmp2.out | grep -v rotate_file_by_name > onenode.out
# Test with "-c" for all nodes
zeekctl scripts -c > tmp3.out
eval ${rmpaths} tmp3.out | grep -v rotate_file_by_name > c-all.out
# Test with "-c" for one node
zeekctl scripts -c worker-1 > tmp4.out
eval ${rmpaths} tmp4.out | grep -v rotate_file_by_name > c-onenode.out