nextcloud-desktop/test
Olivier Goffart a7847a4e82
Upload: Store the size in the UploadInfo, and compare it when resolving potential conflict
This is about the conflicts that happens when the file has been uploaded
correctly to the server, but the etag was not recieved because the connection
was closed before we got the reply.

We used to compare only the mtime when comparing the uploaded file and the
existing file.  However, to be perfectly correct, we also should check the
size.

This was found because TestChunkingNG::connectionDroppedBeforeEtagRecieved is
flaky. Example of faillure found in https://drone.owncloud.com/owncloud/client/481/5
while testing PR #6626

(very trimmed log:)

06-29 07:58:02:015 [ info sync.csync.csync ]:	## Starting local discovery ##
06-29 07:58:02:016 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag:  <-> 1644a8c8750, inode: 1935629 <-> 1935629, size: 301 <-> 300, perms: 0 <-> ff, type: 0 <-> 0, checksum:  <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:016 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:972 [ warning sync.networkjob ]:	QNetworkReply::NetworkError(OperationCanceledError) "Connection timed out" QVariant(Invalid)
.. next sync...
06-29 07:58:02:980 [ info sync.engine ]:	#### Discovery start ####################################################
06-29 07:58:02:981 [ info sync.csync.csync ]:	## Starting local discovery ##
06-29 07:58:02:983 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag:  <-> 1644a8c8750, inode: 1935629 <-> 1935629, size: 302 <-> 300, perms: 0 <-> ff, type: 0 <-> 0, checksum:  <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:983 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:985 [ info sync.csync.csync ]:	## Starting remote discovery ##
06-29 07:58:02:985 [ info sync.networkjob ]:	OCC::LsColJob created for "http://localhost/owncloud" + "" "OCC::DiscoverySingleDirectoryJob"
06-29 07:58:02:987 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag: 1644a8c8b26 <-> 1644a8c8750, inode: 0 <-> 1935629, size: 301 <-> 300, perms: ff <-> ff, type: 0 <-> 0, checksum: SHA1:5adcdac9608ae0811247f07f4cf1ab0a2ef99154 <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:987 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:989 [ info sync.csync.csync ]:	Update detection for remote replica took 0.004 seconds walking 13 files
06-29 07:58:02:990 [ info sync.engine ]:	#### Discovery end ####################################################  9 ms
06-29 07:58:02:990 [ info sync.database ]:	Updating file record for path: "A/a0" inode: 1935629 modtime: 1530259082 type: 0 etag: "1644a8c8b26" fileId: "16383ea4" remotePerm: "WDNVCKR" fileSize: 301 checksum: "SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1"
06-29 07:58:02:990 [ info sync.csync.reconciler ]:	INSTRUCTION_UPDATE_METADATA    client file: A/a0
06-29 07:58:02:990 [ info sync.csync.csync ]:	Reconciliation for local replica took  0 seconds visiting  13  files.
06-29 07:58:02:990 [ info sync.csync.reconciler ]:	INSTRUCTION_UPDATE_METADATA    server dir:  A
06-29 07:58:02:990 [ info sync.csync.csync ]:	Reconciliation for remote replica took  0 seconds visiting  13  files.
06-29 07:58:02:990 [ info sync.engine ]:	#### Reconcile end ####################################################  9 ms
06-29 07:58:02:990 [ info sync.database ]:	Updating local metadata for: "A/a0" 1530259082 302 1935629
FAIL!  : TestChunkingNG::connectionDroppedBeforeEtagRecieved(small file) '!fakeFolder.syncOnce()' returned FALSE. ()
2020-08-13 16:46:08 +02:00
..
benchmarks benchlargesync: Do several syncs 2017-09-25 12:49:55 +02:00
csync Get rid of useless using constructs 2020-08-12 18:18:57 +02:00
manual/favlink License: Adjust license of GPLv2 source files to GPLv2+ 2016-10-25 11:06:54 +02:00
mockserver Use QDateTime::currentDateTimeUtc instead of the non utc version 2017-09-26 16:14:17 +02:00
scripts t9.pl: Make more reliable 2017-10-05 14:13:10 +02:00
CMakeLists.txt Add unit tests for the encryption helpers 2020-08-10 13:13:19 +02:00
nextcloud_add_test.cmake Updater: Fix Tests build (failed with BUILD_UPDATER=NO) 2020-03-10 22:10:45 +01:00
stubfolderman.cpp Fix leak in OCC::AccountManager stub for FolderManTest 2020-05-21 01:22:15 +02:00
stubremotewipe.cpp Once client gets 401/403 from the server, check if remote wipe was requested. 2019-10-17 20:11:31 +02:00
syncenginetestutils.h Enable the modernize-use-equals-default check on clang-tidy 2020-08-13 14:19:42 +02:00
test_journal.db test_journal.db: Add checksumtype table 2017-06-22 15:11:49 +02:00
testallfilesdeleted.cpp Enable the modernize-loop-convert check on clang-tidy 2020-08-13 12:55:14 +00:00
testblacklist.cpp Blacklist: Add unittest #6411 2018-06-11 14:50:01 +02:00
testchecksumvalidator.cpp Use auto to avoiding repeating type names 2020-05-20 03:54:41 +02:00
testchunkingng.cpp TestChunkingNG: Make it faster 2020-08-13 16:46:03 +02:00
testclientsideencryption.cpp Add support for BASE64 encoded '|' when decrypting 2020-08-10 13:13:19 +02:00
testconcaturl.cpp Enable the modernize-use-using check on clang-tidy 2020-08-12 18:18:57 +02:00
testdownload.cpp apply http2 qt resend patch from owncloud 2019-12-25 13:59:15 +08:00
testexcludedfiles.cpp issue1216: added sync-exclude entry for emacs recovery files 2019-05-22 08:52:37 +02:00
testfilesystem.cpp Move Utility to a new common static library 2017-09-05 17:25:19 +02:00
testfolder.cpp Move Utility to a new common static library 2017-09-05 17:25:19 +02:00
testfolderman.cpp Use auto to avoiding repeating type names 2020-05-20 03:54:41 +02:00
testfolderwatcher.cpp Fixed typo preventing successful path rename on Win and modified ASSERT for Window path styles 2019-10-08 08:31:31 +02:00
testhelper.h Once client gets 401/403 from the server, check if remote wipe was requested. 2019-10-17 20:11:31 +02:00
testinotifywatcher.cpp Move Utility to a new common static library 2017-09-05 17:25:19 +02:00
testnetrcparser.cpp For tests we do not need a xserver running. 2016-05-12 11:34:21 +02:00
testnextcloudpropagator.cpp Enable the modernize-use-using check on clang-tidy 2020-08-12 18:18:57 +02:00
testoauth.cpp Remove useless virtual, better use override only 2020-05-18 20:45:20 +02:00
testownsql.cpp OwnSql: Fixup after feedback for #6388 2018-07-03 10:33:26 +02:00
testpermissions.cpp Data-Fingerprint: Fix backup detection when fingerprint is empty 2018-09-10 20:44:03 +02:00
testplan.txt Minor typos in client test section 2015-09-10 18:11:44 +05:45
testremotewipe.cpp Once client gets 401/403 from the server, check if remote wipe was requested. 2019-10-17 20:11:31 +02:00
testsyncconflict.cpp little loops optimization 2019-10-07 01:29:55 +03:00
testsyncengine.cpp Use auto to avoiding repeating type names 2020-05-20 03:54:41 +02:00
testsyncfileitem.cpp For tests we do not need a xserver running. 2016-05-12 11:34:21 +02:00
testsyncfilestatustracker.cpp Use the return braced init list pattern 2020-05-27 14:36:07 +02:00
testsyncjournaldb.cpp Enable the modernize-use-using check on clang-tidy 2020-08-12 18:18:57 +02:00
testsyncmove.cpp little loops optimization 2019-10-07 01:29:55 +03:00
testupdater.cpp For tests we do not need a xserver running. 2016-05-12 11:34:21 +02:00
testuploadreset.cpp Upload: Store the size in the UploadInfo, and compare it when resolving potential conflict 2020-08-13 16:46:08 +02:00
testutility.cpp testLaunchOnStartup shouldn't fail on dev setup 2020-05-27 15:11:25 +02:00
testxmlparse.cpp Properly handle denormalized href 2020-05-18 19:33:34 +02:00