Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
systemtests/tests/copy/etc/bareos/bareos-dir.d/job/migrate.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,9 @@ | ||
Job { | ||
Name = "migrate" | ||
Type = Migrate | ||
Pool = Full | ||
Selection Type = Volume | ||
Selection Pattern = "." | ||
Client = "bareos-fd" | ||
Messages = Standard | ||
} |
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
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,100 @@ | ||
#!/bin/bash | ||
set -e | ||
set -o pipefail | ||
set -u | ||
|
||
TestName=05-migrate | ||
|
||
#shellcheck source=../environment.in | ||
. ./environment | ||
|
||
#shellcheck source=../scripts/functions | ||
. "${rscripts}"/functions | ||
|
||
log="$tmp/$TestName.log" | ||
|
||
start_test | ||
|
||
migration_volume="TestMigrateVolume001" | ||
query_results="$tmp/query_results.out" | ||
|
||
cat <<END_OF_DATA >"$tmp/bconcmds" | ||
@$out /dev/null | ||
messages | ||
@$out $log | ||
label volume=TestVolume002 storage=File pool=Full | ||
run job=backup-bareos-fd level=Full yes | ||
run job=backup-bareos-fd level=Full yes | ||
run job=backup-bareos-fd level=Full yes | ||
wait | ||
update volume=TestVolume002 volstatus=Used | ||
messages | ||
label volume=$migration_volume storage=File2 pool=FullCopy | ||
run migrate yes | ||
wait | ||
messages | ||
@$out $query_results | ||
sqlquery | ||
SELECT count(jobid) FROM job WHERE type='g'; | ||
SELECT count(jobid) FROM job WHERE type='M'; | ||
quit | ||
END_OF_DATA | ||
|
||
run_bconsole | ||
|
||
expect_grep "The following 3 JobIds were chosen to be migrated: 10,11,12" \ | ||
"$log" \ | ||
"Expected jobs to be migrated do not match." | ||
|
||
# 1 administrative job that spawns 3 migration jobs | ||
if [[ $(grep -c "Termination:.*Migration OK" "$log") -ne "4" ]]; then | ||
echo "Not all migration jobs finished successfully." | ||
estat=1 | ||
fi | ||
|
||
if [[ $(grep -c "| 3 |" "$query_results") -ne "2" ]]; then | ||
echo "The necessary amount of migration related jobs are not available in the catalog." | ||
estat=2 | ||
fi | ||
|
||
rm -f $query_results | ||
|
||
cat <<END_OF_DATA >"$tmp/bconcmds" | ||
@$out $query_results | ||
prune volume=TestVolume002 yes | ||
sqlquery | ||
SELECT count(jobid) FROM job WHERE type='M'; | ||
quit | ||
END_OF_DATA | ||
|
||
run_bconsole | ||
|
||
if ! grep "| 0 |" "$query_results" ; then | ||
echo "Migrated jobs were not deleted appropriately after volume pruning." | ||
estat=3 | ||
fi | ||
|
||
rm -f $query_results | ||
|
||
cat <<END_OF_DATA >"$tmp/bconcmds" | ||
@$out $query_results | ||
update volume=$migration_volume volstatus=Used | ||
prune volume=$migration_volume yes | ||
sqlquery | ||
SELECT count(jobid) FROM job WHERE type='g'; | ||
quit | ||
END_OF_DATA | ||
|
||
run_bconsole | ||
|
||
if ! grep "| 0 |" "$query_results" ; then | ||
echo "Migration jobs were not deleted appropriately after volume pruning." | ||
estat=4 | ||
fi | ||
|
||
|
||
|
||
end_test |