File: scripts.test

package info (click to toggle)
zeekctl 2.2.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,544 kB
  • sloc: python: 5,639; sh: 1,374; makefile: 71; awk: 24
file content (36 lines) | stat: -rw-r--r-- 1,535 bytes parent folder | download
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
# 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