Skip to content

Commit f85ea35

Browse files
committed
fix(autotests): do not remove read-only files already removed
the sync engine will remove invalid items inside read-only folders not needed to remove them in tests and rather checks that they were indeed removed Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
1 parent 29ccf59 commit f85ea35

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

test/testpermissions.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private slots:
141141
const auto result = FileSystem::remove(fileInfoToDelete.absoluteFilePath(), &errorString);
142142
if (!result) {
143143
qDebug() << "fail to delete:" << fileInfoToDelete.absoluteFilePath() << errorString;
144-
//QVERIFY(result);
144+
QVERIFY(result);
145145
}
146146
} else {
147147
const auto result = FileSystem::removeRecursively(fileInfoToDelete.absoluteFilePath());
@@ -282,8 +282,6 @@ private slots:
282282
// The file should not exist on the remote, and not be there
283283
QVERIFY(!currentLocalState.find("readonlyDirectory_PERM_M_/newFile_PERM_WDNV_.data"));
284284
QVERIFY(!fakeFolder.currentRemoteState().find("readonlyDirectory_PERM_M_/newFile_PERM_WDNV_.data"));
285-
// remove it so next test succeed.
286-
removeReadOnly("readonlyDirectory_PERM_M_/newFile_PERM_WDNV_.data");
287285
// Both side should still be the same
288286
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
289287

@@ -365,8 +363,8 @@ private slots:
365363
QVERIFY(currentLocalState.find("readonlyDirectory_PERM_M_/subdir_PERM_CK_/subsubdir_PERM_CKDNV_/normalFile_PERM_WVND_.data" ));
366364
// new no longer exists
367365
QVERIFY(!currentLocalState.find("readonlyDirectory_PERM_M_/newname_PERM_CK_/subsubdir_PERM_CKDNV_/normalFile_PERM_WVND_.data" ));
368-
// but is not on server: so remove it locally for the future comparison
369-
removeReadOnly("readonlyDirectory_PERM_M_/newname_PERM_CK_");
366+
// but is not on server: should have been locally removed
367+
QVERIFY(!currentLocalState.find("readonlyDirectory_PERM_M_/newname_PERM_CK_"));
370368

371369
//2.
372370
// old removed
@@ -375,8 +373,8 @@ private slots:
375373
QVERIFY(fakeFolder.currentRemoteState().find("normalDirectory_PERM_CKDNV_/subdir_PERM_CKDNV_"));
376374
// new no longer exists
377375
QVERIFY(!currentLocalState.find("readonlyDirectory_PERM_M_/moved_PERM_CK_/subsubdir_PERM_CKDNV_/normalFile_PERM_WVND_.data" ));
378-
//but not on server
379-
removeReadOnly("readonlyDirectory_PERM_M_/moved_PERM_CK_");
376+
// should have been cleaned up as invalid item inside read-only folder
377+
QVERIFY(!currentLocalState.find("readonlyDirectory_PERM_M_/moved_PERM_CK_"));
380378
fakeFolder.remoteModifier().remove("normalDirectory_PERM_CKDNV_/subdir_PERM_CKDNV_");
381379

382380
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());

0 commit comments

Comments
 (0)