From e51df78ea7fde66704c69083200dab2f351239c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Charaoui?= Date: Sun, 12 Feb 2023 14:47:32 -0500 Subject: [PATCH] fix rdiff local/remote tests --- test/rdiff.bats | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/rdiff.bats b/test/rdiff.bats index 0c3a1b9..c0ab352 100644 --- a/test/rdiff.bats +++ b/test/rdiff.bats @@ -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" ] }