#!/bin/bash
set -e
set -o pipefail
set -u
#
# This systemtest tests the plugin functionality
# of the Bareos FD with the Python LDAP plugin.
#
TestName="$(basename "$(pwd)")"
export TestName

JobName=backup-bareos-fd

#shellcheck source=../../environment.in
. ./environment

#shellcheck source=../../scripts/functions
. "${rscripts}"/functions

start_test

cat <<END_OF_DATA >$tmp/bconcmds
@$out ${NULL_DEV}
messages
@$out $tmp/wrong_credentials.out
setdebug level=100 storage=File
run job=$JobName fileset=PluginFailingTest yes
wait
messages
END_OF_DATA

run_bconsole "$@"

check_for_zombie_jobs storage=File

expect_grep "Failed to bind to LDAP uri due to invalid credentials" "$tmp/wrong_credentials.out"

end_test
