File: start-stop-standalone.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 (54 lines) | stat: -rw-r--r-- 1,366 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
# Test that the start command can start a standalone zeek and create certain
# files, and test that the stop command can stop zeek and remove those files.
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: btest-diff start.out
# @TEST-EXEC: btest-diff stop.out

. zeekctl-test-setup

while read line; do installfile $line; done << EOF
etc/zeekctl.cfg__no_email
bin/zeek__test
EOF

zeekctl install

# verify that these files don't already exist before the start command runs
test ! -e $ZEEKCTL_INSTALL_PREFIX/spool/zeek
test ! -e $ZEEKCTL_INSTALL_PREFIX/spool/stats.log

zeekctl start > start.out

# the start command creates some files (these are NOT created by zeek itself)
while read line; do
    test -e $ZEEKCTL_INSTALL_PREFIX/$line
done << EOF
spool/zeek/.cmdline
spool/zeek/.env_vars
spool/zeek/.pid
spool/zeek/.startup
spool/zeek/stderr.log
spool/zeek/stdout.log
EOF

# verify that starting the node was logged in stats.log
grep started $ZEEKCTL_INSTALL_PREFIX/spool/stats.log


zeekctl stop > stop.out

# the stop command should cleanup the node directory
while read line; do
    test ! -e $ZEEKCTL_INSTALL_PREFIX/$line
done << EOF
spool/zeek/.cmdline
spool/zeek/.env_vars
spool/zeek/.pid
spool/zeek/.startup
spool/zeek/stderr.log
spool/zeek/stdout.log
EOF

# verify that stopping the node was logged in stats.log
grep stopped $ZEEKCTL_INSTALL_PREFIX/spool/stats.log