Skip to content

Commit

Permalink
autoxflate-test: add second sd; add additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebsura authored and BareosBot committed Nov 10, 2023
1 parent 9ec49e1 commit dd15127
Show file tree
Hide file tree
Showing 21 changed files with 324 additions and 44 deletions.
4 changes: 2 additions & 2 deletions systemtests/tests/autoxflate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ get_filename_component(BASENAME ${CMAKE_CURRENT_BINARY_DIR} NAME)
create_systemtest(${SYSTEMTEST_PREFIX} ${BASENAME})

set_tests_properties(
system:autoxflate:replication-single
system:autoxflate:replication-local
PROPERTIES FIXTURES_SETUP "system:bareos-basic:backup-job-fixture"
)

set_tests_properties(
system:autoxflate:replication-distributed
system:autoxflate:replication-offsite
PROPERTIES FIXTURES_SETUP "system:bareos-basic:backup-job-fixture"
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Job {
Type = Restore
Client = bareos-fd
FileSet = SelfTest
Storage = File
Storage = L1
Pool = Incremental
Messages = Standard
Where = @tmp@/bareos-restores
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Job {
Name = "copy"
Name = "copy-local"
Type = Copy
Pool = Full
Selection Type = Volume
Expand All @@ -17,3 +17,43 @@ Job {
Command = "echo 'prevjobid=%O newjobid=%N'"
}
}

Job {
Name = "copy-to-offsite"
Type = Copy
Pool = FullCopy
Selection Type = Volume
Selection Pattern = "."
Client = "bareos-fd"
Messages = Standard
Run Script {
Runs On Client = No
Runs When = Before
Command = "echo 'prevjobid=%O newjobid=%N'"
}
Run Script {
Runs On Client = No
Runs When = After
Command = "echo 'prevjobid=%O newjobid=%N'"
}
}

Job {
Name = "copy-offsite"
Type = Copy
Pool = Offsite
Selection Type = Volume
Selection Pattern = "."
Client = "bareos-fd"
Messages = Standard
Run Script {
Runs On Client = No
Runs When = Before
Command = "echo 'prevjobid=%O newjobid=%N'"
}
Run Script {
Runs On Client = No
Runs When = After
Command = "echo 'prevjobid=%O newjobid=%N'"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ JobDefs {
Level = Incremental
Client = bareos-fd
FileSet = "SelfTest"
Storage = File
Storage = L1
Messages = Standard
Pool = Incremental
Priority = 10
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Pool {
Name = Full
Pool Type = Backup
Recycle = yes # Bareos can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 1 sec # How long should the Full Backups be kept? (#06)
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable
Maximum Volumes = 100 # Limit number of Volumes in Pool
Label Format = "Full-" # Volumes will be labeled "Full-<volume-id>"
Next Pool = FullCopy
}

Pool {
Name = FullCopy
Pool Type = Backup
Recycle = yes # Bareos can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 1 sec # How long should the Full Backups be kept? (#06)
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable
Maximum Volumes = 100 # Limit number of Volumes in Pool
Label Format = "Full-" # Volumes will be labeled "Full-<volume-id>"
Storage = "L2"

NextPool = Offsite
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Pool {
Name = Offsite
Pool Type = Backup
Recycle = yes # Bareos can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 1 sec # How long should the Full Backups be kept? (#06)
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable
Maximum Volumes = 100 # Limit number of Volumes in Pool
Label Format = "O-" # Volumes will be labeled "Full-<volume-id>"
Storage = "O11"

NextPool = OffsiteCopy
}

Pool {
Name = OffsiteCopy
Pool Type = Backup
Recycle = yes # Bareos can automatically recycle Volumes
AutoPrune = yes # Prune expired volumes
Volume Retention = 1 sec # How long should the Full Backups be kept? (#06)
Maximum Volume Bytes = 50G # Limit Volume size to something reasonable
Maximum Volumes = 100 # Limit number of Volumes in Pool
Label Format = "OC-" # Volumes will be labeled "Full-<volume-id>"
Storage = "O12"
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
Storage {
Name = File
Name = L1
Address = @hostname@
Password = "@sd_password@"
Device = FileStorage
Device = LD1
Media Type = File
SD Port = @sd_port@
}

Storage {
Name = File2
Name = L2
Address = @hostname@
Password = "@sd_password@"
Device = FileStorage2
Device = LD2
Media Type = File
SD Port = @sd_port@
}

Storage {
Name = O11
Address = @hostname@
Password = "@sd_password@"
Device = 1D1
Media Type = File
SD Port = @sd2_port@
}

Storage {
Name = O12
Address = @hostname@
Password = "@sd_password@"
Device = 1D2
Media Type = File
SD Port = @sd2_port@
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Device {
Name = FileStorage
Name = LD1
Media Type = File
Archive Device = storage
LabelMedia = yes; # lets Bareos label unlabeled media
Expand All @@ -10,7 +10,7 @@ Device {
Description = "File device. A connecting Director must have the same Name and MediaType."
}
Device {
Name = FileStorage2
Name = LD2
Media Type = File
Archive Device = storage
LabelMedia = yes; # lets Bareos label unlabeled media
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Storage {
Name = bareos-sd
Name = bareos-sd-local
Maximum Concurrent Jobs = 20

Working Directory = "@working_dir@"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Device {
Name = 1D1
Media Type = File
Archive Device = storage
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."

Auto Deflate = write # Compress data as it's written to disk
Auto Deflate Algorithm = LZ4
}

Device {
Name = 1D2
Media Type = File
Archive Device = storage
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."

Auto Inflate = write # Decompress data as it's written to disk
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Device {
Name = FileStorage
Media Type = File
Archive Device = storage
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."
}
Device {
Name = FileStorage2
Media Type = File
Archive Device = storage
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."

Auto Inflate = out # Decompress data as it's written to disk
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Director {
Name = bareos-dir
Password = "@sd_password@"
Description = "Director, who is permitted to contact this storage daemon."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Messages {
Name = Standard
Director = bareos-dir = all
Description = "Send all messages to the Director."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Storage {
Name = bareos-sd-1
Maximum Concurrent Jobs = 20

Working Directory = "@working_dir@"
SD Port = @sd2_port@
@sd_backend_config@

Plugin Directory = "@SD_PLUGINS_DIR_TO_TEST@"
Plugin Names = "autoxflate"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Storage {
Name = bareos-sd
Maximum Concurrent Jobs = 20

Working Directory = "@working_dir@"
SD Port = @sd_port@
@sd_backend_config@

Plugin Directory = "@SD_PLUGINS_DIR_TO_TEST@"
Plugin Names = "autoxflate"
Auto XFlate On Replication = yes
}
6 changes: 5 additions & 1 deletion systemtests/tests/autoxflate/test-setup
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ export TestName
setup_data

bin/bareos start
bin/bareos status

"${BAREOS_STORAGEDAEMON_BINARY}" -c "${BAREOS_CONFIG_DIR}"/../sd-1 -t </dev/null
"${BAREOS_STORAGEDAEMON_BINARY}" -c "${BAREOS_CONFIG_DIR}"/../sd-1

bin/bareos status
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ start_test
cat <<END_OF_DATA >"$tmp/bconcmds"
@$out ${tmp}/backup.out
messages
label volume=TestVolume001 storage=File pool=Full
label volume=TestVolume001 storage=L1 pool=Full
run job=backup-bareos-fd level=Full yes
wait
update volume=TestVolume001 volstatus=Used
messages
@$out ${tmp}/copy.out
label volume=TestCopyVolume001 storage=File2 pool=FullCopy
setdebug level=$debug_level storage=File
setdebug level=$debug_level storage=File2
run copy yes
label volume=TestCopyVolume001 storage=L2 pool=FullCopy
setdebug level=$debug_level storage=L1
setdebug level=$debug_level storage=L2
run copy-local yes
wait
setdebug level=0 storage=File
setdebug level=0 storage=File2
update volume=TestCopyVolume001 volstatus=Used
setdebug level=0 storage=L1
setdebug level=0 storage=L2
messages
@$out ${tmp}/restore.out
restore jobid=4 client=bareos-fd where=$tmp/bareos-restores all done yes
Expand All @@ -68,11 +69,11 @@ run_bconsole "$@"
# There should be no difference
check_restore_diff "${BackupDirectory}"

if ! is_file_compressed "FileStorage" "TestVolume001" "${File}"; then
if ! is_file_compressed "LD1" "TestVolume001" "${File}"; then
echo "TestVolume001 is not compressed"
estat=3
fi
if is_file_compressed "FileStorage2" "TestCopyVolume001" "${File}"; then
if is_file_compressed "LD2" "TestCopyVolume001" "${File}"; then
echo "TestCopyVolume001 is not uncompressed"
estat=4
fi
Expand Down
Loading

0 comments on commit dd15127

Please sign in to comment.