diff options
author | Christian Kamm <mail@ckamm.de> | 2017-11-16 12:13:21 +0300 |
---|---|---|
committer | ckamm <mail@ckamm.de> | 2017-11-16 15:31:54 +0300 |
commit | e694ffcd03d91ed2a4203d6cf874a8efdddcb4e5 (patch) | |
tree | 07a9d0621f7fa6e5623e3f872da535fa8395ed21 /test | |
parent | eff401d4187047b9a08fe5e21ca7b9e4fce32816 (diff) |
PropagateDownload: Adjustments to skipping downloads #6153
Previously we required matching mtimes but that's actually
unnecessary when the question is about whether to skip the
download. We will still update the file's metadata.
Also, adjust behavior when the checksum is weak (Adler32):
in these cases we still depend on equal mtimes.
Diffstat (limited to 'test')
-rw-r--r-- | test/testsyncengine.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index c3db53ab6..5f38ff7cd 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -311,6 +311,22 @@ private slots: QVERIFY(fakeFolder.syncOnce()); QCOMPARE(nGET, 1); + // Conflict: Same content, different mtime, matching checksums + // -> PropagateDownload, but it skips the download + mtime = mtime.addDays(1); + fakeFolder.localModifier().setContents("A/a1", 'C'); + fakeFolder.localModifier().setModTime("A/a1", mtime); + fakeFolder.remoteModifier().setContents("A/a1", 'C'); + fakeFolder.remoteModifier().setModTime("A/a1", mtime.addDays(1)); + remoteInfo.find("A/a1")->checksums = "SHA1:56900fb1d337cf7237ff766276b9c1e8ce507427"; + QVERIFY(fakeFolder.syncOnce()); + // check that mtime in journal and filesystem agree + QString a1path = fakeFolder.localPath() + "A/a1"; + SyncJournalFileRecord a1record; + fakeFolder.syncJournal().getFileRecord(QByteArray("A/a1"), &a1record); + QCOMPARE(a1record._modtime, (qint64)FileSystem::getModTime(a1path)); + QCOMPARE(nGET, 1); + // Extra sync reads from db, no difference QVERIFY(fakeFolder.syncOnce()); QCOMPARE(nGET, 1); |