#!/usr/share/ucs-test/runner bash
# shellcheck shell=bash
## desc: "Test univention-samba4-backup"
## exposure: dangerous
## packages:
##  - univention-samba4
## roles:
## - domaincontroller_master
## - domaincontroller_backup
## - domaincontroller_slave

# shellcheck source=../../lib/base.sh
. "$TESTLIBPATH/base.sh" || exit 137

backup_dir="/var/univention-backup/samba"
number_of_backup_files_before="$(find "$backup_dir"/samba-backup-*.tar.bz2 | wc -l)"
univention-samba4-backup || fail_test "univention-samba4-backup failed"
number_of_backup_files_after="$(find "$backup_dir"/samba-backup-*.tar.bz2 | wc -l)"
test "$number_of_backup_files_after" -gt "$number_of_backup_files_before" ||  fail_test "no backup archive found after running univention-samba4-backup"
exit "$RETVAL"
