diff options
author | Christian Kamm <mail@ckamm.de> | 2017-05-17 14:10:19 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2017-05-17 14:10:19 +0300 |
commit | 5eaae83a01e3a622842d44f20e7614f96a281140 (patch) | |
tree | d08f187a6416e4733f00cf27f40161ebaef61fad /test/testsyncengine.cpp | |
parent | c50136d675adcdb40f9f3eb097cca721cb5b73dc (diff) | |
parent | c09a828f7b5c85233db558d60a3ef84b85bcd102 (diff) |
Merge remote-tracking branch 'origin/2.3'
Diffstat (limited to 'test/testsyncengine.cpp')
-rw-r--r-- | test/testsyncengine.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 59314222f..242d5e438 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -213,6 +213,49 @@ private slots: } } + void testSelectiveSyncBug() { + // issue owncloud/enterprise#1965: files from selective-sync ignored + // folders are uploaded anyway is some circumstances. + FakeFolder fakeFolder{FileInfo{ QString(), { + FileInfo { QStringLiteral("parentFolder"), { + FileInfo{ QStringLiteral("subFolder"), { + { QStringLiteral("fileA.txt"), 400 }, + { QStringLiteral("fileB.txt"), 400, 'o' } + }} + }} + }}}; + + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + auto expectedServerState = fakeFolder.currentRemoteState(); + + // Remove subFolder with selectiveSync: + fakeFolder.syncEngine().journal()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, + {"parentFolder/subFolder/"}); + fakeFolder.syncEngine().journal()->avoidReadFromDbOnNextSync("parentFolder/subFolder/"); + + // But touch a local file before the next sync, such that the local folder + // can't be removed + fakeFolder.localModifier().setContents("parentFolder/subFolder/fileB.txt", 'n'); + + // Several follow-up syncs don't change the state at all, + // in particular the remote state doesn't change and fileB.txt + // isn't uploaded. + + for (int i = 0; i < 3; ++i) { + fakeFolder.syncOnce(); + + { + // Nothing changed on the server + QCOMPARE(fakeFolder.currentRemoteState(), expectedServerState); + // The local state should still have subFolderA + auto local = fakeFolder.currentLocalState(); + QVERIFY(local.find("parentFolder/subFolder")); + QVERIFY(local.find("parentFolder/subFolder/fileA.txt")); + QVERIFY(local.find("parentFolder/subFolder/fileB.txt")); + } + } + } + void abortAfterFailedMkdir() { FakeFolder fakeFolder{FileInfo{}}; QSignalSpy finishedSpy(&fakeFolder.syncEngine(), SIGNAL(finished(bool))); |