zeek/auxil/zeekctl/testing/command/start-perms.test
Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

31 lines
827 B
Plaintext

# Test that the start command fails immediately when zeekctl lacks the needed
# permissions to the zeek working directory, and gives a useful error message.
#
# Skip this test if running as the superuser.
# @TEST-REQUIRES: test `id -u` -ne 0
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff start.out
# @TEST-EXEC: btest-diff status.out
. zeekctl-test-setup
while read line; do installfile $line; done << EOF
etc/zeekctl.cfg__no_email
bin/zeek__test
EOF
zeekctl install
# need to create the working dir
zeekctl start
zeekctl stop
# Remove write access to working dir.
chmod ugo-w $ZEEKCTL_INSTALL_PREFIX/spool/zeek
# Verify that the start command returns non-zero.
! zeekctl start > start.out 2>&1
# Verify that the status is "stopped".
! zeekctl status > status.out