Files
rclone/fs/logger/testdata/script/TestRepoCompare.txtar
Nick Craig-Wood eb84a383a3 fs/logger: fix flaky tests by generating test data locally
The TestLogger/TestRepoCompare and TestLogger/TestBeforeVsAfter
testscript scenarios filled src and dst by downloading two old rclone
source archives from GitHub with `rclone copyurl`. Whenever GitHub or
the network hiccuped (eg a 502 Bad Gateway) the downloads failed and
the tests failed with it, making them flaky on CI.

Generate two overlapping trees of files in the test Setup instead.
They cover the same comparison categories the scripts exercise
(matching, differing, src-only and dst-only files) so the tests are
just as meaningful but no longer depend on the network.
2026-06-01 20:47:11 +01:00

45 lines
2.2 KiB
Plaintext

# tests whether rclone check and rclone sync output exactly the same file lists.
# src and dst are filled by the test Setup with two overlapping trees of files
# (lots of files with the same name but different content) to produce a more
# realistic test than makefiles.
# running rclone check for baseline test:
# error is expected here:
! exec rclone check $SRC $DST --match $WORK/CHECKmatch.txt --combined $WORK/CHECKcombined.txt --missing-on-src $WORK/CHECKmissingonsrc.txt --missing-on-dst $WORK/CHECKmissingondst.txt --error $WORK/CHECKerr.txt --differ $WORK/CHECKdiffer.txt -q
# running sync with output files:
exec rclone sync $SRC $DST --match $WORK/SYNCmatch.txt --combined $WORK/SYNCcombined.txt --missing-on-src $WORK/SYNCmissingonsrc.txt --missing-on-dst $WORK/SYNCmissingondst.txt --error $WORK/SYNCerr.txt --differ $WORK/SYNCdiffer.txt
# sorting them by line and diffing:
exec sort $WORK/CHECKmatch.txt -o $WORK/CHECKmatch.txt
exec sort $WORK/CHECKcombined.txt -o $WORK/CHECKcombined.txt
exec sort $WORK/CHECKmissingonsrc.txt -o $WORK/CHECKmissingonsrc.txt
exec sort $WORK/CHECKmissingondst.txt -o $WORK/CHECKmissingondst.txt
exec sort $WORK/CHECKerr.txt -o $WORK/CHECKerr.txt
exec sort $WORK/CHECKdiffer.txt -o $WORK/CHECKdiffer.txt
exec sort $WORK/SYNCmatch.txt -o $WORK/SYNCmatch.txt
exec sort $WORK/SYNCcombined.txt -o $WORK/SYNCcombined.txt
exec sort $WORK/SYNCmissingonsrc.txt -o $WORK/SYNCmissingonsrc.txt
exec sort $WORK/SYNCmissingondst.txt -o $WORK/SYNCmissingondst.txt
exec sort $WORK/SYNCerr.txt -o $WORK/SYNCerr.txt
exec sort $WORK/SYNCdiffer.txt -o $WORK/SYNCdiffer.txt
# diff match check vs. sync:
cmp $WORK/CHECKmatch.txt $WORK/SYNCmatch.txt
# diff combined check vs. sync:
cmp $WORK/CHECKcombined.txt $WORK/SYNCcombined.txt
# diff missingonsrc check vs. sync:
cmp $WORK/CHECKmissingonsrc.txt $WORK/SYNCmissingonsrc.txt
# diff missingondst check vs. sync:
cmp $WORK/CHECKmissingondst.txt $WORK/SYNCmissingondst.txt
# diff error check vs. sync:
cmp $WORK/CHECKerr.txt $WORK/SYNCerr.txt
# diff differ check vs. sync:
cmp $WORK/CHECKdiffer.txt $WORK/SYNCdiffer.txt
# verify accuracy
exec rclone check $SRC $DST
exec diff -rya --suppress-common-lines $SRC $DST
[!windows] exec rsync -aEvhPu $SRC/ $WORK/rsyncDst
[!windows] exec rclone check $DST $WORK/rsyncDst