Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

33 lines
1.1 KiB
Plaintext

# Test that plugins are loaded by default.
#
# @TEST-EXEC: bash %INPUT
. zeekctl-test-setup
# Create a subdirectory to verify that zeekctl searches for plugins in subdirs
mkdir $ZEEKCTL_INSTALL_PREFIX/lib/zeek/plugins/more
# Install some test plugins in directories where zeekctl searches by default
while read line; do installfile $line; done << EOF
etc/zeekctl.cfg__debug
plugins/optionstest.py $ZEEKCTL_INSTALL_PYTHON_DIR/zeekctl/plugins --new
plugins/commandtest.py $ZEEKCTL_INSTALL_PYTHON_DIR/zeekctl/plugins --new
plugins/nodekeystest.py lib/zeek/plugins --new
plugins/zeekctlconfigtest.py lib/zeek/plugins/more --new
EOF
# Rename a valid plugin file so that it won't be loaded
cd $ZEEKCTL_INSTALL_PYTHON_DIR/zeekctl/plugins
mv commandtest.py commandtest
cd -
debuglog=$ZEEKCTL_INSTALL_PREFIX/spool/debug.log
zeekctl exit
# Verify that the expected plugins were found
grep "Found plugin optionstest from" ${debuglog}
grep "Found plugin nodekeystest from" ${debuglog}
grep "Found plugin zeekctlconfigtest from" ${debuglog}
! grep "Found plugin commandtest from" ${debuglog}