Skip to content

Commit

Permalink
systemtests py3plug-fd-ldap: add another test case
Browse files Browse the repository at this point in the history
Also test how the plugin behaves with wrong credentials.
  • Loading branch information
joergsteffens authored and Sebastian Lederer committed Mar 7, 2024
1 parent cbf53c4 commit a4fb780
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 13 deletions.
@@ -0,0 +1,10 @@
FileSet {
Name = "PluginFailingTest"
Description = "Test the Plugin functionality with a Python Plugin."
Include {
Options {
Signature = XXH128
}
Plugin = "@python_module_name@:module_path=@python_plugin_module_src_test_dir@:module_name=bareos-fd-ldap:uri=ldap\\://@SYSTEMTEST_LDAP_ADDRESS_ESCAPED@:basedn=ou=backup,@SYSTEMTEST_LDAP_BASEDN@:bind_dn=@SYSTEMTEST_LDAP_BINDDN@:password=INVALID_PASSWORD"
}
}
Expand Up @@ -8,40 +8,35 @@ set -u
#
TestName="$(basename "$(pwd)")"
export TestName
bucket_name=bareos-test

JobName=backup-bareos-fd

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

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

testdata_opts=( \
--address "$SYSTEMTEST_LDAP_ADDRESS" \
--basedn "$SYSTEMTEST_LDAP_BASEDN" \
--binddn "$SYSTEMTEST_LDAP_BINDDN" \
--password "$SYSTEMTEST_LDAP_PASSWORD"
)

start_test

tar xzf ../../data/image.tgz
./testdata.py "${testdata_opts[@]}" \
--clean \
--populate \
--dump-backup > backup-data-before.ldif

JobName=backup-bareos-fd
#shellcheck source=../scripts/functions
. "${rscripts}"/functions
"${rscripts}"/cleanup
"${rscripts}"/setup


start_test

cat <<END_OF_DATA >$tmp/bconcmds
@$out /dev/null
messages
@$out $tmp/log1.out
setdebug level=100 storage=File
label volume=TestVolume001 storage=File pool=Full
run job=$JobName yes
status director
status client
Expand All @@ -60,10 +55,9 @@ messages
quit
END_OF_DATA

run_bareos "$@"
run_bconsole "$@"

check_for_zombie_jobs storage=File
stop_bareos

check_two_logs

Expand Down
38 changes: 38 additions & 0 deletions systemtests/tests/py3plug-fd-ldap/testrunner-wrong_credentials
@@ -0,0 +1,38 @@
#!/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 /dev/null
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

0 comments on commit a4fb780

Please sign in to comment.