fix rdiff local/remote tests

This commit is contained in:
Jérôme Charaoui 2023-02-12 14:47:32 -05:00
parent 167163788c
commit e51df78ea7
No known key found for this signature in database
GPG Key ID: 69C52F658E988542

View File

@ -397,12 +397,13 @@ finish_rdiff() {
}
@test "verify local backup" {
rm -f "${BATS_TMPDIR}/_rdiff-verify.log"
rdiff-backup -v5 --verify "${BN_BACKUPDIR}/testrdiff" > "${BATS_TMPDIR}/_rdiff-verify.log"
}
@test "verify number of files in local backup matches source" {
SRC_FILES="$(find "${BN_SRCDIR}" -type f -not -path "${BN_SRCDIR}/var/*" | wc -l)"
BACKUP_FILES="$(grep '^Verified SHA1 digest of' "${BATS_TMPDIR}/_rdiff-verify.log" | wc -l)"
BACKUP_FILES="$(grep -c 'Verified SHA1 digest of' "${BATS_TMPDIR}/_rdiff-verify.log")"
[ "$SRC_FILES" -eq "$BACKUP_FILES" ]
}
@ -416,12 +417,14 @@ finish_rdiff() {
}
@test "verify remote backup" {
rdiff-backup -v5 --verify "${BN_BACKUPDIR}/testrdiff" > "${BATS_TMPDIR}/_rdiff-verify.log"
rm -f "${BATS_TMPDIR}/_rdiff-verify.log"
ssh "${BN_REMOTEUSER}@${BN_REMOTEHOST}" -- rdiff-backup -v5 --verify "${BN_BACKUPDIR}/testrdiff" > "${BATS_TMPDIR}/_rdiff-verify.log"
}
@test "verify number of files in remote backup matches source" {
SRC_FILES="$(find "${BN_SRCDIR}" -type f -not -path "${BN_SRCDIR}/var/*" | wc -l)"
BACKUP_FILES="$(grep '^Verified SHA1 digest of' "${BATS_TMPDIR}/_rdiff-verify.log" | wc -l)"
BACKUP_FILES="$(grep -c 'Verified SHA1 digest of' "${BATS_TMPDIR}/_rdiff-verify.log")"
echo "$SRC_FILES $BACKUP_FILES"
[ "$SRC_FILES" -eq "$BACKUP_FILES" ]
}