diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2020-03-20 19:39:10 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2020-03-25 13:40:43 +0300 |
commit | a359baec4376cb508075b48307a48b8d82d5dcd3 (patch) | |
tree | f1ea34846e67f4f1e6c1b15ebc6edf6fea6515fa /test | |
parent | 3504ae8fc5e0a9fe0f2dc79d03a80ba83745cf3f (diff) |
Sync: Fix handling of virtual files in error state
Issue: #7799
Diffstat (limited to 'test')
-rw-r--r-- | test/testsyncmove.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/test/testsyncmove.cpp b/test/testsyncmove.cpp index 984b853ca..4a33180bc 100644 --- a/test/testsyncmove.cpp +++ b/test/testsyncmove.cpp @@ -880,7 +880,8 @@ private slots: } return s; }; - const QByteArray testPath = "folder/folderA/file.txt"; + const QString src = "folder/folderA/file.txt"; + const QString dest = "folder/folderB/file.txt"; FakeFolder fakeFolder{ FileInfo{ QString(), { FileInfo{ QStringLiteral("folder"), { FileInfo{ QStringLiteral("folderA"), { { QStringLiteral("file.txt"), 400 } } }, QStringLiteral("folderB") } } } } }; QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); @@ -896,8 +897,13 @@ private slots: fakeFolder.syncOnce(); } - fakeFolder.serverErrorPaths().append(testPath, 403); - fakeFolder.localModifier().rename(getName(testPath), getName("folder/folderB/file.txt")); + + fakeFolder.serverErrorPaths().append(src, 403); + fakeFolder.localModifier().rename(getName(src), getName(dest)); + QVERIFY(!fakeFolder.currentLocalState().find(getName(src))); + QVERIFY(fakeFolder.currentLocalState().find(getName(dest))); + QVERIFY(fakeFolder.currentRemoteState().find(src)); + QVERIFY(!fakeFolder.currentRemoteState().find(dest)); // sync1 file gets detected as error, instruction is still NEW_FILE fakeFolder.syncOnce(); @@ -910,8 +916,16 @@ private slots: fakeFolder.syncJournal().internalPinStates().setForPath("", PinState::AlwaysLocal); fakeFolder.syncOnce(); } - // the sync must have failed as we have a file in the error state - QVERIFY(fakeFolder.currentLocalState() != fakeFolder.currentRemoteState()); + + QVERIFY(!fakeFolder.currentLocalState().find(src)); + QVERIFY(fakeFolder.currentLocalState().find(getName(dest))); + if (vfsMode == Vfs::WithSuffix) + { + // the placeholder was not restored as it is still in error state + QVERIFY(!fakeFolder.currentLocalState().find(dest)); + } + QVERIFY(fakeFolder.currentRemoteState().find(src)); + QVERIFY(!fakeFolder.currentRemoteState().find(dest)); } }; |