File: diag.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 (63 lines) | stat: -rw-r--r-- 1,481 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
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