Skip to content

Commit

Permalink
systemtests: adapted bareos test to include list jobs test
Browse files Browse the repository at this point in the history
  • Loading branch information
alaaeddineelamri authored and pstorz committed Dec 6, 2021
1 parent 85372de commit 8667504
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 9 deletions.
40 changes: 40 additions & 0 deletions systemtests/tests/bareos/test-setup
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")"
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ JobName=backup-bareos-fd

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



# Fill ${BackupDirectory} with data.
setup_data

start_test

Expand Down Expand Up @@ -50,9 +43,8 @@ messages
quit
END_OF_DATA

run_bareos "$@"
run_bconsole
check_for_zombie_jobs storage=File
stop_bareos

check_two_logs
check_restore_diff "${BackupDirectory}"
Expand Down
45 changes: 45 additions & 0 deletions systemtests/tests/bareos/testrunner-simple-list-jobs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
set -e
set -o pipefail
set -u
#
# Run a simple backup
# then restore it.
#
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/log-list-jobs.out
run job=$JobName yes
wait
list jobs
quit
END_OF_DATA

run_bconsole

#check that `list jobs` returns the correct columms and data
if ! grep "| jobid | name | client | starttime | duration | type | level | jobfiles | jobbytes | jobstatus |" "$tmp"/log-list-jobs.out; then
echo "Missing or wrong list jobs columns. Check $tmp/log-list-jobs.out" >&2
estat=1
fi

if ! grep "| 1 | backup-bareos-fd | bareos-fd | ....-..-.. ..:..:.. | ..:..:.. | B | F | 73 |" "$tmp"/log-list-jobs.out; then
echo "Missing or wrong list jobs data. Check $tmp/log-list-jobs.out" >&2
estat=1
fi

end_test

0 comments on commit 8667504

Please sign in to comment.