Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for always incremental scheme
- Loading branch information
Showing
15 changed files
with
275 additions
and
0 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
9 changes: 9 additions & 0 deletions
9
configs/always-incremental-test/bareos-dir.d/job/Consolidate.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 = "Consolidate" | ||
JobDefs = "DefaultJob" | ||
Schedule = Consolidate | ||
Type = Consolidate | ||
Storage = File1 | ||
Pool = AI-Incremental | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
configs/always-incremental-test/bareos-dir.d/job/RestoreFiles.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,11 @@ | ||
Job { | ||
Name = "RestoreFiles" | ||
Description = "Standard Restore template. Only one such job is needed for all standard Jobs/Clients/Storage ..." | ||
Type = Restore | ||
Client = bareos-fd | ||
FileSet = "FS_TESTJOB" | ||
Storage = File1 | ||
Pool = Default | ||
Messages = Standard | ||
Where = /tmp/bareos-restores | ||
} |
16 changes: 16 additions & 0 deletions
16
configs/always-incremental-test/bareos-dir.d/job/backup-bareos-fd.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,16 @@ | ||
Job { | ||
Name = "backup-bareos-fd" | ||
JobDefs = "DefaultJob" | ||
Client = "bareos-fd" | ||
|
||
Pool = AI-Incremental | ||
Full Backup Pool = AI-Full | ||
|
||
# Always incremental settings | ||
AlwaysIncremental = yes | ||
AlwaysIncrementalJobRetention = 1 seconds | ||
AlwaysIncrementalKeepNumber = 2 | ||
Accurate = yes | ||
|
||
} | ||
|
12 changes: 12 additions & 0 deletions
12
configs/always-incremental-test/bareos-dir.d/pool/AI-Full.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,12 @@ | ||
Pool { | ||
Name = AI-Full | ||
Pool Type = Backup | ||
Recycle = yes # Bareos can automatically recycle Volumes | ||
AutoPrune = yes # Prune expired volumes | ||
Volume Retention = 180 days # How long should the AI-Full Backups be kept? (#06) | ||
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable | ||
Label Format = "AI-Full-" # Volumes will be labeled "AI-Full-<volume-id>" | ||
Volume Use Duration = 23h | ||
Storage = File2 | ||
Next Pool = AI-Longterm | ||
} |
12 changes: 12 additions & 0 deletions
12
configs/always-incremental-test/bareos-dir.d/pool/AI-Incremental.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,12 @@ | ||
Pool { | ||
Name = AI-Incremental | ||
Pool Type = Backup | ||
Recycle = yes # Bareos can automatically recycle Volumes | ||
AutoPrune = yes # Prune expired volumes | ||
Volume Retention = 180 days # How long should the AI-Incremental Backups be kept? (#06) | ||
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable | ||
Label Format = "AI-Incremental-" # Volumes will be labeled "AI-Incremental-<volume-id>" | ||
Volume Use Duration = 23h | ||
Storage = File1 | ||
Next Pool = AI-Full | ||
} |
11 changes: 11 additions & 0 deletions
11
configs/always-incremental-test/bareos-dir.d/pool/AI-Longterm.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,11 @@ | ||
Pool { | ||
Name = AI-Longterm | ||
Pool Type = Backup | ||
Recycle = yes # Bareos can automatically recycle Volumes | ||
AutoPrune = yes # Prune expired volumes | ||
Volume Retention = 180 days # How long should the AI-Longterm Backups be kept? (#06) | ||
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable | ||
Label Format = "AI-Longterm-" # Volumes will be labeled "AI-Longterm-<volume-id>" | ||
Volume Use Duration = 23h | ||
Storage = File1 | ||
} |
9 changes: 9 additions & 0 deletions
9
configs/always-incremental-test/bareos-dir.d/pool/Default.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 @@ | ||
Pool { | ||
Name = Default | ||
Pool Type = Backup | ||
Recycle = yes # Bareos can automatically recycle Volumes | ||
AutoPrune = yes # Prune expired volumes | ||
Maximum Volumes = 20 | ||
Maximum Volume Bytes = 100M | ||
} | ||
|
5 changes: 5 additions & 0 deletions
5
configs/always-incremental-test/bareos-dir.d/pool/Scratch.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,5 @@ | ||
Pool { | ||
Name = Scratch | ||
Pool Type = Scratch | ||
} | ||
|
3 changes: 3 additions & 0 deletions
3
configs/always-incremental-test/bareos-dir.d/schedule/Consolidate.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,3 @@ | ||
Schedule { | ||
Name = "Consolidate" | ||
} |
14 changes: 14 additions & 0 deletions
14
configs/always-incremental-test/bareos-dir.d/storage/File1.conf.in
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,14 @@ | ||
Storage { | ||
Name = File1 | ||
Address = @hostname@ | ||
Password = "@sd_password@" | ||
Device = File1 | ||
Media Type = File | ||
TLS Require = yes | ||
TLS Certificate = "@scriptdir@/tls/bareos-dir.bareos.org-cert.pem" | ||
TLS Key = "@scriptdir@/tls/bareos-dir.bareos.org-key.pem" | ||
TLS CA Certificate File = "@scriptdir@/tls/bareos-ca.pem" | ||
TLS Verify Peer = no | ||
TLS Allowed CN = bareos-sd1.bareos.org | ||
TLS Allowed CN = bareos-sd2.bareos.org | ||
} |
14 changes: 14 additions & 0 deletions
14
configs/always-incremental-test/bareos-dir.d/storage/File2.conf.in
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,14 @@ | ||
Storage { | ||
Name = File2 | ||
Address = @hostname@ | ||
Password = "@sd_password@" | ||
Device = File2 | ||
Media Type = File | ||
TLS Require = yes | ||
TLS Certificate = "@scriptdir@/tls/bareos-dir.bareos.org-cert.pem" | ||
TLS Key = "@scriptdir@/tls/bareos-dir.bareos.org-key.pem" | ||
TLS CA Certificate File = "@scriptdir@/tls/bareos-ca.pem" | ||
TLS Verify Peer = no | ||
TLS Allowed CN = bareos-sd1.bareos.org | ||
TLS Allowed CN = bareos-sd2.bareos.org | ||
} |
12 changes: 12 additions & 0 deletions
12
configs/always-incremental-test/bareos-sd.d/device/FileStorage.conf.in
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,12 @@ | ||
Device { | ||
Name = File1 | ||
Media Type = File | ||
Archive Device = @archivedir@ | ||
LabelMedia = yes; # lets Bareos label unlabeled media | ||
Random Access = yes; | ||
AutomaticMount = yes; # when device opened, read it | ||
RemovableMedia = no; | ||
AlwaysOpen = no; | ||
Description = "File device. A connecting Director must have the same Name and MediaType." | ||
} | ||
|
12 changes: 12 additions & 0 deletions
12
configs/always-incremental-test/bareos-sd.d/device/FileStorage2.conf.in
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,12 @@ | ||
Device { | ||
Name = File2 | ||
Media Type = File | ||
Archive Device = @archivedir@ | ||
LabelMedia = yes; # lets Bareos label unlabeled media | ||
Random Access = yes; | ||
AutomaticMount = yes; # when device opened, read it | ||
RemovableMedia = no; | ||
AlwaysOpen = no; | ||
Description = "File device. A connecting Director must have the same Name and MediaType." | ||
} | ||
|
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,134 @@ | ||
#!/bin/sh | ||
|
||
. scripts/functions | ||
|
||
# | ||
# Example regression test. | ||
# | ||
# Use this as a template for your own tests. | ||
# | ||
|
||
# Define the Name of the test as "TestName". | ||
# Should be the same as the filename, therefore we use the filename as default. | ||
TestName="`basename $0`" | ||
#TestName="1-example-test" | ||
|
||
# set other test specific variables | ||
Client=bareos-fd | ||
JobName=backup-bareos-fd | ||
|
||
# Directory to backup. | ||
# This example uses a subdirectory of the bareos source/build directory, | ||
# that contains some file but isn't to large. | ||
BackupDirectory="${cwd}/build/src/tests/" | ||
|
||
# Remove old configuration, working and tmp files. Setup the database. | ||
cleanup | ||
|
||
# Config files will be copied to required location. | ||
# Base configuration files come from the | ||
# configs/BASE/ directory, see | ||
# configs/BASE/README.txt for an overview of the provides resources. | ||
# Store your additonal resources to | ||
# configs/$TestName. | ||
# It is also possible to overwrite resources from configs/BASE. | ||
# If you define a full config file (instead of config files for individual resources), | ||
# only these will be taken. | ||
copy_configs | ||
|
||
# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". | ||
echo "${BackupDirectory}" >${tmp}/file-list | ||
|
||
# start the test | ||
start_test | ||
|
||
|
||
# create a new file and run multiple backups | ||
for file in 1 2 3 4 5 6 7 ; do | ||
|
||
echo file$file > ${BackupDirectory}/file$file | ||
|
||
cat <<END_OF_DATA >${tmp}/bconcmds | ||
messages | ||
@$out ${tmp}/log1.out w | ||
run job=$JobName yes | ||
wait | ||
messages | ||
END_OF_DATA | ||
run_bareos | ||
check_for_zombie_jobs storage=File1 client=${Client} | ||
stop_bareos | ||
done | ||
|
||
|
||
cat <<END_OF_DATA >${tmp}/bconcmds | ||
@# | ||
@# try to consolidate | ||
@# | ||
@$out ${tmp}/log1.out w | ||
list jobs | ||
run job=Consolidate yes | ||
wait | ||
list jobs | ||
messages | ||
END_OF_DATA | ||
|
||
# Start the bareos daemon | ||
# and run the bconsole commands from ${tmp}/bconcmds | ||
run_bareos | ||
|
||
# verify that all are terminated | ||
check_for_zombie_jobs storage=File1 client=${Client} | ||
|
||
# stop bareos | ||
stop_bareos | ||
cat <<END_OF_DATA >${tmp}/bconcmds | ||
@# | ||
@# now do a restore | ||
@# | ||
@$out ${tmp}/log2.out w | ||
restore client=${Client} where=${tmp}/bareos-restores select | ||
unmark * | ||
mark * | ||
done | ||
yes | ||
wait | ||
messages | ||
quit | ||
END_OF_DATA | ||
|
||
# Start the bareos daemon | ||
# and run the bconsole commands from ${tmp}/bconcmds | ||
run_bareos | ||
|
||
# verify that all are terminated | ||
check_for_zombie_jobs storage=File1 client=${Client} | ||
|
||
# stop bareos | ||
stop_bareos | ||
|
||
# check tmp/log1.out and tmp/log2.out for errors | ||
check_two_logs | ||
|
||
# check for differences between original files and restored files | ||
check_restore_diff ${BackupDirectory} | ||
|
||
# do some manual testing | ||
if ! [ -d ${BackupDirectory} ]; then | ||
set_error "Directory ${BackupDirectory} does not exists any more." | ||
fi | ||
|
||
|
||
# check if consolidation worked as expected | ||
grep "purged JobIds 1,2,3,4,5 as they were consolidated into Job 9" tmp/log1.out || set_error "consolidation did not consolidate jobs that were expected" | ||
|
||
# check if the expected jobids were chosen for restore | ||
grep "You have selected the following JobIds: 9,6,7" tmp/log2.out || set_error "other jobs than expected were chosen for restore" | ||
|
||
# check if all files were restored | ||
for file in 1 2 3 4 5 6 7 ; do | ||
grep $file ${tmp}/bareos-restores/${BackupDirectory}/file$file || set_error "file $file was not recovered" | ||
done | ||
|
||
# end tests and check for error codes | ||
end_test |