Skip to content

Commit

Permalink
systemtests: add messages-test
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Feb 10, 2020
1 parent a9a9f63 commit 6328afd
Show file tree
Hide file tree
Showing 29 changed files with 130 additions and 180 deletions.

This file was deleted.

31 changes: 0 additions & 31 deletions core/src/tests/configs/messages/bareos-dir.d/client/bareos-fd.conf

This file was deleted.

11 changes: 0 additions & 11 deletions core/src/tests/configs/messages/bareos-dir.d/fileset/Catalog.conf

This file was deleted.

31 changes: 0 additions & 31 deletions core/src/tests/configs/messages/bareos-dir.d/fileset/LinuxAll.conf

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

35 changes: 0 additions & 35 deletions core/src/tests/configs/messages/bareos-dir.d/storage/File.conf

This file was deleted.

1 change: 1 addition & 0 deletions systemtests/CMakeLists.txt
Expand Up @@ -616,6 +616,7 @@ set(SYSTEM_TESTS
reload-works-on-adding-second-director-resource
reload-works-on-adding-client-resource
backup-bareos-client-initiated-test
messages-test
)

set(SYSTEM_TESTS_DISABLED # initially empty
Expand Down
@@ -0,0 +1,8 @@
Catalog {
Name = MyCatalog
#dbdriver = "@DEFAULT_DB_TYPE@"
dbdriver = "XXX_REPLACE_WITH_DATABASE_DRIVER_XXX"
dbname = "@db_name@"
dbuser = "@db_user@"
dbpassword = "@db_password@"
}
@@ -0,0 +1,7 @@
Client {
Name = bareos-fd
Description = "Client resource of the Director itself."
Address = localhost
Password = "@fd_password@" # password for FileDaemon
FD PORT = @fd_port@
}
@@ -1,7 +1,7 @@
Console {
Name = bareos-mon
Description = "Restricted console used by tray-monitor to get the status of the director."
Password = "mon_dir_password"
Password = "@mon_dir_password@"
CommandACL = status, .status
JobACL = *all*
}
@@ -1,9 +1,9 @@
Director { # define myself
Name = bareos-dir
QueryFile = "/tmp/scripts/query.sql"
QueryFile = "@scriptdir@/query.sql"
Maximum Concurrent Jobs = 10
Password = "dir_password" # Console password
Messages = Standard
Password = "@dir_password@" # Console password
Messages = Daemon
Auditing = yes

# Enable the Heartbeat if you experience connection losses
Expand All @@ -13,15 +13,15 @@ Director { # define myself
# Heartbeat Interval = 1 min

# remove comment in next line to load dynamic backends from specified directory
Backend Directory = /tmp/core/src/cats
Backend Directory = @backenddir@

# remove comment from "Plugin Directory" to load plugins from specified directory.
# if "Plugin Names" is defined, only the specified plugins will be loaded,
# otherwise all director plugins (*-dir.so) from the "Plugin Directory".
#
# Plugin Directory = "/tmp/plugindir"
# Plugin Directory = "@python_plugin_module_src_dir@"
# Plugin Names = ""
Working Directory = "/tmp/tests/backup-bareos-test/working"
Pid Directory = "/tmp/piddir"
DirPort = 42001
Working Directory = "@working_dir@"
Pid Directory = "@piddir@"
DirPort = @dir_port@
}
@@ -0,0 +1,11 @@
FileSet {
Name = "Catalog"
Description = "Backup the catalog dump and Bareos configuration files."
Include {
Options {
signature = MD5
}
File = "@working_dir@/@db_name@.sql" # database dump
File = "@confdir@" # configuration
}
}
Expand Up @@ -5,7 +5,7 @@ FileSet {
Options {
Signature = MD5 # calculate md5 checksum per file
}
#File = "/tmp/sbin"
File=</tmp/tests/backup-bareos-test/tmp/file-list
#File = "@sbindir@"
File=<@tmpdir@/file-list
}
}
Expand Up @@ -4,18 +4,17 @@ Job {
JobDefs = "DefaultJob"
Level = Full
FileSet="Catalog"
Schedule = "WeeklyCycleAfterBackup"

# This creates an ASCII copy of the catalog
# Arguments to make_catalog_backup.pl are:
# make_catalog_backup.pl <catalog-name>
RunBeforeJob = "/tmp/scripts/make_catalog_backup.pl MyCatalog"
RunBeforeJob = "@scriptdir@/make_catalog_backup.pl MyCatalog"

# This deletes the copy of the catalog
RunAfterJob = "/tmp/scripts/delete_catalog_backup"
RunAfterJob = "@scriptdir@/delete_catalog_backup"

# This sends the bootstrap via mail for disaster recovery.
# Should be sent to another system, please change recipient accordingly
Write Bootstrap = "|/tmp/bin/bsmtp -h smtp_host -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" root@localhost" # (#01)
Write Bootstrap = "|@bindir@/bsmtp -h @smtp_host@ -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" @job_email@" # (#01)
Priority = 11 # run after main backup
}
Expand Up @@ -3,9 +3,9 @@ Job {
Description = "Standard Restore template. Only one such job is needed for all standard Jobs/Clients/Storage ..."
Type = Restore
Client = bareos-fd
FileSet = "LinuxAll"
FileSet = SelfTest
Storage = File
Pool = Incremental
Messages = Standard
Where = /tmp/tests/backup-bareos-test/tmp/tmp/bareos-restores
Where = @tmp@/bareos-restores
}
Expand Up @@ -3,14 +3,13 @@ JobDefs {
Type = Backup
Level = Incremental
Client = bareos-fd
FileSet = "SelfTest" # selftest fileset (#13)
Schedule = "WeeklyCycle"
FileSet = "SelfTest"
Storage = File
Messages = Standard
Pool = Incremental
Priority = 10
Write Bootstrap = "/tmp/tests/backup-bareos-test/working/%c.bsr"
Full Backup Pool = Full # write Full Backups into "Full" Pool (#05)
Differential Backup Pool = Differential # write Diff Backups into "Differential" Pool (#08)
Incremental Backup Pool = Incremental # write Incr Backups into "Incremental" Pool (#11)
Write Bootstrap = "@working_dir@/%c.bsr"
Full Backup Pool = Full # write Full Backups into "Full" Pool
Differential Backup Pool = Differential # write Diff Backups into "Differential" Pool
Incremental Backup Pool = Incremental # write Incr Backups into "Incremental" Pool
}
@@ -0,0 +1,7 @@
Messages {
Name = Daemon
Description = "Message delivery for daemon messages (no job)."
console = all, !skipped, !saved, !audit
append = "@logdir@/bareos.log" = all, !skipped, !audit
append = "@logdir@/bareos-audit.log" = audit
}
@@ -0,0 +1,7 @@
Messages {
Name = Standard
Description = "Reasonable message delivery -- send most everything to email address and to the console."
console = all, !skipped, !saved, !audit
append = "@logdir@/bareos.log" = all, !skipped, !saved, !audit
catalog = all, !skipped, !saved, !audit
}
@@ -0,0 +1,8 @@
Storage {
Name = File
Address = @hostname@ # N.B. Use a fully qualified name here (do not use "localhost" here).
Password = "@sd_password@"
Device = FileStorage
Media Type = File
SD Port = @sd_port@
}
60 changes: 60 additions & 0 deletions systemtests/tests/messages-test/testrunner
@@ -0,0 +1,60 @@
#!/bin/sh
#
# 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
"${rscripts}"/cleanup
"${rscripts}"/setup


# Directory to backup.
# This directory will be created by setup_data "$@"().
BackupDirectory="${tmp}/data"

# Use a tgz to setup data to be backed up.
# Data will be placed at "${tmp}/data/".
setup_data "$@"

start_test

cat <<END_OF_DATA >$tmp/bconcmds
@$out /dev/null
messages
@$out $tmp/log1.out
setdebug level=100 storage=File
label volume=TestVolume001 storage=File pool=Full
run job=$JobName yes
status director
status client
status storage=File
wait
messages
@#
@# now do a restore
@#
@$out $tmp/log2.out
wait
restore client=bareos-fd fileset=SelfTest where=$tmp/bareos-restores select all done
yes
wait
messages
quit
END_OF_DATA

run_bareos "$@"
check_for_zombie_jobs storage=File
stop_bareos

check_two_logs
check_restore_diff ${BackupDirectory}
end_test

0 comments on commit 6328afd

Please sign in to comment.