File: cleanup.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 (56 lines) | stat: -rw-r--r-- 1,752 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
# Test that the cleanup command does not cleanup any running nodes, and
# does not cleanup tmpdir unless the "--all" option is specified.
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: btest-diff cleanup.out
# @TEST-EXEC: btest-diff cleanup-onenode.out
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff cleanup-all.out
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff cleanup-all-onenode.out

. zeekctl-test-setup

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

zeekctl install
zeekctl start
touch $ZEEKCTL_INSTALL_PREFIX/spool/worker-1/testfile
touch $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testfile

#########################
# test the cleanup command (with and without a node argument)
zeekctl cleanup > cleanup.out
zeekctl cleanup worker-1 > cleanup-onenode.out

# the node testfile should still exist
test -e $ZEEKCTL_INSTALL_PREFIX/spool/worker-1/testfile

# the tmpdir testfile should still exist
test -e $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testfile

#########################
# test "cleanup --all" (without a node argument)
zeekctl cleanup --all > cleanup-all.out

# the node testfile should still exist
test -e $ZEEKCTL_INSTALL_PREFIX/spool/worker-1/testfile

# the tmpdir testfile should be gone
test ! -e $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testfile

touch $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testfile

#########################
# test "cleanup --all" (with a node argument)
zeekctl cleanup --all worker-1 > cleanup-all-onenode.out

# the node testfile should still exist
test -e $ZEEKCTL_INSTALL_PREFIX/spool/worker-1/testfile

# the tmpdir testfile should be gone
test ! -e $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testfile

zeekctl stop