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 print command can print a value from a standalone node,
# all nodes in a cluster, or just a specified node.
#
# This test needs to be serialized because we are using the broker python
# bindings.
# @TEST-SERIALIZE: listen
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: btest-diff standalone.out
# @TEST-EXEC: btest-diff all.out
# @TEST-EXEC: btest-diff onenode.out
. zeekctl-test-setup
while read line; do installfile $line; done << EOF
etc/zeekctl.cfg__no_email
etc/networks.cfg__ipv4
EOF
# Test with a standalone config.
cat > $ZEEKCTL_INSTALL_PREFIX/etc/node.cfg << EOF
[zeek]
type=standalone
host=localhost
EOF
zeekctl install
zeekctl start
# Print a single-line value.
zeekctl print Log::default_rotation_interval > standalone.out
zeekctl stop
# Test with a cluster config.
while read line; do installfile $line; done << EOF
etc/node.cfg__no_netifs
EOF
zeekctl install
zeekctl start
# Print a single-line value from all nodes
zeekctl print Log::default_rotation_interval > all.out
# Print a multi-line value from one node
zeekctl print Site::local_nets worker-2 > onenode.out
zeekctl stop
# No nodes are running, so zeekctl cannot get any results
! zeekctl print Log::default_rotation_interval > stopped.out
# The file size should be zero
test ! -s stopped.out
|