-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
director: fix crash in status scheduler when client is not set
- Loading branch information
Showing
6 changed files
with
114 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
systemtests/tests/scheduler-backup/etc/bareos/bareos-dir.d/job/copy.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Job { | ||
Name = "copy" | ||
Type = Copy | ||
Pool = Full | ||
Selection Type = Volume | ||
Selection Pattern = "." | ||
Client = "bareos-fd" | ||
Messages = Standard | ||
Schedule = TestCycle | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# BAREOS® - Backup Archiving REcovery Open Sourced | ||
# | ||
# Copyright (C) 2021-2021 Bareos GmbH & Co. KG | ||
# | ||
# This program is Free Software; you can redistribute it and/or | ||
# modify it under the terms of version three of the GNU Affero General Public | ||
# License as published by the Free Software Foundation and included | ||
# in the file LICENSE. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
# 02110-1301, USA. | ||
|
||
set -e | ||
set -o pipefail | ||
set -u | ||
|
||
#shellcheck source=../environment.in | ||
. ./environment | ||
|
||
#shellcheck source=../scripts/functions | ||
. "${rscripts}"/functions | ||
"${rscripts}"/cleanup | ||
"${rscripts}"/setup | ||
|
||
# Fill ${BackupDirectory} with data. | ||
setup_data | ||
|
||
bin/bareos start | ||
|
||
# make sure, director is up and running. | ||
print_debug "$(bin/bconsole <<< "status dir")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
systemtests/tests/scheduler-backup/testrunner-scheduler-status-copy-job
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
set -e | ||
set -o pipefail | ||
set -u | ||
|
||
TestName="$(basename "$(pwd)")" | ||
export TestName | ||
|
||
#shellcheck source=../environment.in | ||
. ./environment | ||
|
||
#shellcheck source=../scripts/functions | ||
. "${rscripts}"/functions | ||
|
||
# | ||
# Run test to check correct output of #`status scheduler job=...` | ||
# of a copy job whose client is disabled | ||
# | ||
|
||
start_test | ||
|
||
cat <<END_OF_DATA >$tmp/bconcmds | ||
messages | ||
@$out $tmp/log3.out w | ||
enable client=bareos-fd | ||
status scheduler job=copy | ||
@$out $tmp/log4.out w | ||
disable client=bareos-fd | ||
status scheduler job=copy | ||
wait | ||
messages | ||
quit | ||
END_OF_DATA | ||
|
||
run_bconsole | ||
|
||
#check that `status scheduler job=...` returns scheduled copy jobs | ||
if ! grep "TestCycle Level=Full" "$tmp"/log3.out; then | ||
echo "No scheduled job was found in $tmp/log3.out, which should contain all scheduled jobs" >&2 | ||
estat=1 | ||
fi | ||
|
||
#check that `status scheduler job=...` returns nothing when we disable the client | ||
if grep "TestCycle Level=Full" "$tmp"/log4.out; then | ||
echo "a scheduled job was listed in $tmp/log4.out, which shouldn't happen" >&2 | ||
estat=1 | ||
fi | ||
|
||
end_test |