// More complicated. The REMOVE is canceled. Restore will happen next sync.
qCInfo(lcDisco) << "Undid remove instruction on source" << originalPath;
_discoveryData->_statedb->deleteFileRecord(originalPath, true);
+ _discoveryData->_statedb->schedulePathForRemoteDiscovery(originalPath);
_discoveryData->_anotherSyncNeeded = true;
} else {
// Signal to future checkPermissions() to forbid the REMOVE and set to restore instead
FakeFolder fakeFolder{ FileInfo() };
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
+ // Some of this test depends on the order of discovery. With threading
+ // that order becomes effectively random, but we want to make sure to test
+ // all cases and thus disable threading.
+ auto syncOpts = fakeFolder.syncEngine().syncOptions();
+ syncOpts._parallelNetworkJobs = 1;
+ fakeFolder.syncEngine().setSyncOptions(syncOpts);
+
const int cannotBeModifiedSize = 133;
const int canBeModifiedSize = 144;
{
FakeFolder fakeFolder{FileInfo{}};
+ // Some of this test depends on the order of discovery. With threading
+ // that order becomes effectively random, but we want to make sure to test
+ // all cases and thus disable threading.
+ auto syncOpts = fakeFolder.syncEngine().syncOptions();
+ syncOpts._parallelNetworkJobs = 1;
+ fakeFolder.syncEngine().setSyncOptions(syncOpts);
+
auto &lm = fakeFolder.localModifier();
auto &rm = fakeFolder.remoteModifier();
rm.mkdir("allowed");
QVERIFY(itemInstruction(completeSpy, "zallowed/sub2/file", CSYNC_INSTRUCTION_NEW));
QCOMPARE(fakeFolder.syncEngine().isAnotherSyncNeeded(), ImmediateFollowUp);
- // A follow-up sync will restore allowed/file and allowed/sub2 and maintain the createdir/file errors
+ // A follow-up sync will restore allowed/file and allowed/sub2 and maintain the nocreatedir/file errors
completeSpy.clear();
QVERIFY(!fakeFolder.syncOnce());
QVERIFY(itemInstruction(completeSpy, "allowed/file", CSYNC_INSTRUCTION_NEW));
QVERIFY(itemInstruction(completeSpy, "allowed/sub2", CSYNC_INSTRUCTION_NEW));
QVERIFY(itemInstruction(completeSpy, "allowed/sub2/file", CSYNC_INSTRUCTION_NEW));
+
+ auto cls = fakeFolder.currentLocalState();
+ QVERIFY(cls.find("allowed/file"));
+ QVERIFY(cls.find("allowed/sub2"));
+ QVERIFY(cls.find("zallowed/file"));
+ QVERIFY(cls.find("zallowed/sub2"));
+ QVERIFY(cls.find("zallowed/sub2/file"));
}
};