diff --git a/tests/integration/full-restore-roundtrip.sh b/tests/integration/full-restore-roundtrip.sh index 9f54db1..3cb3c81 100755 --- a/tests/integration/full-restore-roundtrip.sh +++ b/tests/integration/full-restore-roundtrip.sh @@ -195,7 +195,7 @@ OUT=$(run_on ngb-frt-restore backup:restore:full offsite "$SNAP" "${RESTORE_OPTS fail "restore:full" } printf '%s\n' "$OUT" | grep -q "maintenance mode while the restore runs" || fail "the restore did not say it runs in maintenance mode" -run_on ngb-frt-restore status 2>&1 | grep -q "maintenance: false" || fail "maintenance mode is still on after the restore" +run_on ngb-frt-restore status 2>&1 | grep "maintenance: false" >/dev/null || fail "maintenance mode is still on after the restore" run_on ngb-frt-restore config:app:get ng_backup restore_full_started >/dev/null 2>&1 && fail "the restore left its 'started' marker behind" ok "backup:restore:full completed, in maintenance mode and out of it again" if [ "$DB" = sqlite ]; then @@ -209,7 +209,8 @@ fi # Everything below must work in a FRESH occ process (a new PHP process per docker exec), since # earlier bugs here only showed up after config.php's secret was rewritten mid-restore. run_on ngb-frt-restore backup:status >/dev/null || fail "backup:status fails after restore (own key/target undecryptable?)" -run_on ngb-frt-restore user:list | grep -q frtest || fail "the backed-up user is missing from the restored database" +# not grep -q: it stops reading at the first match, and occ, still writing, then fails (pipefail) +run_on ngb-frt-restore user:list | grep frtest >/dev/null || fail "the backed-up user is missing from the restored database" docker exec ngb-frt-restore test -f /var/www/html/data/frtest/files/Docs/note.txt || fail "restored file is missing" [ "$(docker exec ngb-frt-restore cat /var/www/html/data/frtest/files/Docs/note.txt)" = "hello disaster recovery" ] || fail "restored file content differs" run_on ngb-frt-restore files:scan frtest >/dev/null || fail "files:scan fails after restore" diff --git a/tests/integration/roundtrip.sh b/tests/integration/roundtrip.sh index da5f281..4e25dec 100755 --- a/tests/integration/roundtrip.sh +++ b/tests/integration/roundtrip.sh @@ -52,16 +52,17 @@ ok "restore new-folder and replace: files identical, extra file in the trash" # One file to a local directory, where a restore that was stopped left its temporary. ONE=/tmp/ngb-rt-one/data/$U/files/Docs $X sh -c "mkdir -p $ONE && echo partial > $ONE/f2.bin.ngb-restore-0123456789ab" -occ backup:restore ci "$SNAP" "data/$U/files/Docs/f2.bin" -d /tmp/ngb-rt-one | grep -q "Restored 1 files" || fail "restore of one file to a directory" +occ backup:restore ci "$SNAP" "data/$U/files/Docs/f2.bin" -d /tmp/ngb-rt-one | grep "Restored 1 files" >/dev/null || fail "restore of one file to a directory" $X sh -c "cmp -s $ONE/f2.bin $DATA/$U/files/Docs/f2.bin" || fail "the file restored to a directory differs" $X sh -c "ls -A $ONE | grep -q ngb-restore" && fail "the temporary of a stopped restore was left" ok "restore of one file to a directory; the temporary of a stopped restore removed" -occ backup:status | grep -q "started (" || fail "backup:status does not name the time zone" +# not grep -q: it stops reading at the first match, and occ, still writing, then fails (pipefail) +occ backup:status | grep "started (" >/dev/null || fail "backup:status does not name the time zone" ok "backup:status names the time zone of its times" # Checksum audit: shallow (index presence) and deep (download, decrypt, verify every blob). -occ backup:verify ci "$SNAP" | grep -q "^OK$" || fail "shallow verify" -occ backup:verify ci "$SNAP" --deep | grep -q "^OK$" || fail "deep verify" +occ backup:verify ci "$SNAP" | grep "^OK$" >/dev/null || fail "shallow verify" +occ backup:verify ci "$SNAP" --deep | grep "^OK$" >/dev/null || fail "deep verify" ok "shallow and deep checksum audit" # Database dump/restore round trip (all tables, checksums, sequences on PostgreSQL). diff --git a/tests/integration/user-roundtrip.sh b/tests/integration/user-roundtrip.sh index 67bc48c..52099f0 100755 --- a/tests/integration/user-roundtrip.sh +++ b/tests/integration/user-roundtrip.sh @@ -36,7 +36,8 @@ MANIFEST=$(occ backup:user:backup ci "$U" | sed -n 's/.* to \(.*\)\.$/\1/p') [ -n "$MANIFEST" ] || fail "backup:user:backup printed no manifest path" ok "backed up $U to $MANIFEST" -occ backup:user:list ci "$U" | grep -qF "$MANIFEST" || fail "backup:user:list does not show $MANIFEST" +# not grep -q: it stops reading at the first match, and occ, still writing, then fails (pipefail) +occ backup:user:list ci "$U" | grep -F "$MANIFEST" >/dev/null || fail "backup:user:list does not show $MANIFEST" ok "backup:user:list shows the export" # as-backup: restore into -bak; the original account must stay untouched. $U has one export,