mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 14:05:58 +03:00
Do not ignore return values for SyncJournalDB in unit tests.
Signed-off-by: allexzander <blackslayer4@gmail.com>
This commit is contained in:
parent
65cd8d06bc
commit
5175d186a4
12 changed files with 57 additions and 61 deletions
|
@ -1198,7 +1198,7 @@ static FileInfo &findOrCreateDirs(FileInfo &base, PathComponents components)
|
||||||
FileInfo FakeFolder::dbState() const
|
FileInfo FakeFolder::dbState() const
|
||||||
{
|
{
|
||||||
FileInfo result;
|
FileInfo result;
|
||||||
_journalDb->getFilesBelowPath("", [&](const OCC::SyncJournalFileRecord &record) {
|
[[maybe_unused]] const auto journalDbResult =_journalDb->getFilesBelowPath("", [&](const OCC::SyncJournalFileRecord &record) {
|
||||||
auto components = PathComponents(record.path());
|
auto components = PathComponents(record.path());
|
||||||
auto &parentDir = findOrCreateDirs(result, components.parentDirComponents());
|
auto &parentDir = findOrCreateDirs(result, components.parentDirComponents());
|
||||||
auto name = components.fileName();
|
auto name = components.fileName();
|
||||||
|
|
|
@ -177,7 +177,7 @@ private slots:
|
||||||
return waitAndChain(waitForeverCallback)(tc, request);
|
return waitAndChain(waitForeverCallback)(tc, request);
|
||||||
})));
|
})));
|
||||||
|
|
||||||
fakeFolder.syncJournal().wipeErrorBlacklist();
|
QVERIFY(fakeFolder.syncJournal().wipeErrorBlacklist() != -1);
|
||||||
|
|
||||||
// This second sync will redo the files that had errors
|
// This second sync will redo the files that had errors
|
||||||
// But the waiting folder will not complete before it is aborted.
|
// But the waiting folder will not complete before it is aborted.
|
||||||
|
|
|
@ -14,7 +14,7 @@ using namespace OCC;
|
||||||
SyncJournalFileRecord journalRecord(FakeFolder &folder, const QByteArray &path)
|
SyncJournalFileRecord journalRecord(FakeFolder &folder, const QByteArray &path)
|
||||||
{
|
{
|
||||||
SyncJournalFileRecord rec;
|
SyncJournalFileRecord rec;
|
||||||
folder.syncJournal().getFileRecord(path, &rec);
|
[[maybe_unused]] const auto result = folder.syncJournal().getFileRecord(path, &rec);
|
||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ private slots:
|
||||||
QVERIFY(realFolder);
|
QVERIFY(realFolder);
|
||||||
for (const auto &dummyImageName : dummmyImageNames) {
|
for (const auto &dummyImageName : dummmyImageNames) {
|
||||||
if (fakeFolder.syncJournal().getFileRecord(dummyImageName, &record)) {
|
if (fakeFolder.syncJournal().getFileRecord(dummyImageName, &record)) {
|
||||||
realFolder->journalDb()->setFileRecord(record);
|
QVERIFY(realFolder->journalDb()->setFileRecord(record));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ private slots:
|
||||||
QVERIFY(!trackerContains("A/spurious")); // removed due to full discovery
|
QVERIFY(!trackerContains("A/spurious")); // removed due to full discovery
|
||||||
|
|
||||||
fakeFolder.serverErrorPaths().clear();
|
fakeFolder.serverErrorPaths().clear();
|
||||||
fakeFolder.syncJournal().wipeErrorBlacklist();
|
QVERIFY(fakeFolder.syncJournal().wipeErrorBlacklist() != -1);
|
||||||
tracker.addTouchedPath("A/newspurious"); // will be removed due to successful sync
|
tracker.addTouchedPath("A/newspurious"); // will be removed due to successful sync
|
||||||
|
|
||||||
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem, tracker.localDiscoveryPaths());
|
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem, tracker.localDiscoveryPaths());
|
||||||
|
|
|
@ -67,7 +67,7 @@ bool itemInstruction(const ItemCompletedSpy &spy, const QString &path, const Syn
|
||||||
SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
|
SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
|
||||||
{
|
{
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
folder.syncJournal().getFileRecord(path, &record);
|
[[maybe_unused]] const auto result = folder.syncJournal().getFileRecord(path, &record);
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,11 +75,11 @@ void triggerDownload(FakeFolder &folder, const QByteArray &path)
|
||||||
{
|
{
|
||||||
auto &journal = folder.syncJournal();
|
auto &journal = folder.syncJournal();
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
journal.getFileRecord(path, &record);
|
if (!journal.getFileRecord(path, &record) || !record.isValid()) {
|
||||||
if (!record.isValid())
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
record._type = ItemTypeVirtualFileDownload;
|
record._type = ItemTypeVirtualFileDownload;
|
||||||
journal.setFileRecord(record);
|
QVERIFY(journal.setFileRecord(record));
|
||||||
journal.schedulePathForRemoteDiscovery(record._path);
|
journal.schedulePathForRemoteDiscovery(record._path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,11 +87,11 @@ void markForDehydration(FakeFolder &folder, const QByteArray &path)
|
||||||
{
|
{
|
||||||
auto &journal = folder.syncJournal();
|
auto &journal = folder.syncJournal();
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
journal.getFileRecord(path, &record);
|
if (!journal.getFileRecord(path, &record) || !record.isValid()) {
|
||||||
if (!record.isValid())
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
record._type = ItemTypeVirtualFileDehydration;
|
record._type = ItemTypeVirtualFileDehydration;
|
||||||
journal.setFileRecord(record);
|
QVERIFY(journal.setFileRecord(record));
|
||||||
journal.schedulePathForRemoteDiscovery(record._path);
|
journal.schedulePathForRemoteDiscovery(record._path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,8 +237,8 @@ private slots:
|
||||||
QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a3").size(), 33);
|
QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a3").size(), 33);
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
fakeFolder.syncEngine().journal()->deleteFileRecord("A/a2");
|
QVERIFY(fakeFolder.syncEngine().journal()->deleteFileRecord("A/a2"));
|
||||||
fakeFolder.syncEngine().journal()->deleteFileRecord("A/a3");
|
QVERIFY(fakeFolder.syncEngine().journal()->deleteFileRecord("A/a3"));
|
||||||
fakeFolder.remoteModifier().remove("A/a3");
|
fakeFolder.remoteModifier().remove("A/a3");
|
||||||
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::FilesystemOnly);
|
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::FilesystemOnly);
|
||||||
QVERIFY(fakeFolder.syncOnce());
|
QVERIFY(fakeFolder.syncOnce());
|
||||||
|
@ -456,7 +456,7 @@ private slots:
|
||||||
|
|
||||||
auto cleanup = [&]() {
|
auto cleanup = [&]() {
|
||||||
completeSpy.clear();
|
completeSpy.clear();
|
||||||
fakeFolder.syncJournal().wipeErrorBlacklist();
|
QVERIFY(fakeFolder.syncJournal().wipeErrorBlacklist() != -1);
|
||||||
};
|
};
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
|
@ -735,8 +735,7 @@ private slots:
|
||||||
};
|
};
|
||||||
auto hasDehydratedDbEntries = [&](const QString &path) {
|
auto hasDehydratedDbEntries = [&](const QString &path) {
|
||||||
SyncJournalFileRecord rec;
|
SyncJournalFileRecord rec;
|
||||||
fakeFolder.syncJournal().getFileRecord(path, &rec);
|
return fakeFolder.syncJournal().getFileRecord(path, &rec) && rec.isValid() && rec._type == ItemTypeVirtualFile;
|
||||||
return rec.isValid() && rec._type == ItemTypeVirtualFile;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QVERIFY(isDehydrated("A/a1"));
|
QVERIFY(isDehydrated("A/a1"));
|
||||||
|
|
|
@ -57,7 +57,7 @@ bool expectAndWipeConflict(FileModifier &local, FileInfo state, const QString pa
|
||||||
SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
|
SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
|
||||||
{
|
{
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
folder.syncJournal().getFileRecord(path, &record);
|
[[maybe_unused]] const auto result = folder.syncJournal().getFileRecord(path, &record);
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ private slots:
|
||||||
|
|
||||||
auto getDbChecksum = [&](QString path) {
|
auto getDbChecksum = [&](QString path) {
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
fakeFolder.syncJournal().getFileRecord(path, &record);
|
[[maybe_unused]] const auto result = fakeFolder.syncJournal().getFileRecord(path, &record);
|
||||||
return record._checksumHeader;
|
return record._checksumHeader;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ private slots:
|
||||||
fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QByteArrayLiteral("parentFolder/subFolderA/"));
|
fakeFolder.syncEngine().journal()->schedulePathForRemoteDiscovery(QByteArrayLiteral("parentFolder/subFolderA/"));
|
||||||
auto getEtag = [&](const QByteArray &file) {
|
auto getEtag = [&](const QByteArray &file) {
|
||||||
SyncJournalFileRecord rec;
|
SyncJournalFileRecord rec;
|
||||||
fakeFolder.syncJournal().getFileRecord(file, &rec);
|
[[maybe_unused]] const auto result = fakeFolder.syncJournal().getFileRecord(file, &rec);
|
||||||
return rec._etag;
|
return rec._etag;
|
||||||
};
|
};
|
||||||
QVERIFY(getEtag("parentFolder") == "_invalid_");
|
QVERIFY(getEtag("parentFolder") == "_invalid_");
|
||||||
|
@ -336,8 +336,7 @@ private slots:
|
||||||
QVERIFY(!fakeFolder.syncOnce());
|
QVERIFY(!fakeFolder.syncOnce());
|
||||||
|
|
||||||
SyncJournalFileRecord rec;
|
SyncJournalFileRecord rec;
|
||||||
fakeFolder.syncJournal().getFileRecord(QByteArrayLiteral("NewFolder"), &rec);
|
QVERIFY(fakeFolder.syncJournal().getFileRecord(QByteArrayLiteral("NewFolder"), &rec) && rec.isValid());
|
||||||
QVERIFY(rec.isValid());
|
|
||||||
QCOMPARE(rec._etag, QByteArrayLiteral("_invalid_"));
|
QCOMPARE(rec._etag, QByteArrayLiteral("_invalid_"));
|
||||||
QVERIFY(!rec._fileId.isEmpty());
|
QVERIFY(!rec._fileId.isEmpty());
|
||||||
}
|
}
|
||||||
|
@ -454,7 +453,7 @@ private slots:
|
||||||
// check that mtime in journal and filesystem agree
|
// check that mtime in journal and filesystem agree
|
||||||
QString a1path = fakeFolder.localPath() + "A/a1";
|
QString a1path = fakeFolder.localPath() + "A/a1";
|
||||||
SyncJournalFileRecord a1record;
|
SyncJournalFileRecord a1record;
|
||||||
fakeFolder.syncJournal().getFileRecord(QByteArray("A/a1"), &a1record);
|
QVERIFY(fakeFolder.syncJournal().getFileRecord(QByteArray("A/a1"), &a1record));
|
||||||
QCOMPARE(a1record._modtime, (qint64)FileSystem::getModTime(a1path));
|
QCOMPARE(a1record._modtime, (qint64)FileSystem::getModTime(a1path));
|
||||||
|
|
||||||
// Extra sync reads from db, no difference
|
// Extra sync reads from db, no difference
|
||||||
|
|
|
@ -68,7 +68,7 @@ private slots:
|
||||||
|
|
||||||
// Update checksum
|
// Update checksum
|
||||||
record._checksumHeader = "Adler32:newchecksum";
|
record._checksumHeader = "Adler32:newchecksum";
|
||||||
_db.updateFileRecordChecksum("foo", "newchecksum", "Adler32");
|
QVERIFY(_db.updateFileRecordChecksum("foo", "newchecksum", "Adler32"));
|
||||||
QVERIFY(_db.getFileRecord(QByteArrayLiteral("foo"), &storedRecord));
|
QVERIFY(_db.getFileRecord(QByteArrayLiteral("foo"), &storedRecord));
|
||||||
QVERIFY(storedRecord == record);
|
QVERIFY(storedRecord == record);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ private slots:
|
||||||
record._fileId = "efg";
|
record._fileId = "efg";
|
||||||
record._remotePerm = RemotePermissions::fromDbValue("NV");
|
record._remotePerm = RemotePermissions::fromDbValue("NV");
|
||||||
record._fileSize = 289055;
|
record._fileSize = 289055;
|
||||||
_db.setFileRecord(record);
|
QVERIFY(_db.setFileRecord(record));
|
||||||
QVERIFY(_db.getFileRecord(QByteArrayLiteral("foo"), &storedRecord));
|
QVERIFY(_db.getFileRecord(QByteArrayLiteral("foo"), &storedRecord));
|
||||||
QVERIFY(storedRecord == record);
|
QVERIFY(storedRecord == record);
|
||||||
|
|
||||||
|
@ -213,11 +213,11 @@ private slots:
|
||||||
record._type = type;
|
record._type = type;
|
||||||
record._etag = initialEtag;
|
record._etag = initialEtag;
|
||||||
record._remotePerm = RemotePermissions::fromDbValue("RW");
|
record._remotePerm = RemotePermissions::fromDbValue("RW");
|
||||||
_db.setFileRecord(record);
|
QVERIFY(_db.setFileRecord(record));
|
||||||
};
|
};
|
||||||
auto getEtag = [&](const QByteArray &path) {
|
auto getEtag = [&](const QByteArray &path) {
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
_db.getFileRecord(path, &record);
|
[[maybe_unused]] const auto result = _db.getFileRecord(path, &record);
|
||||||
return record._etag;
|
return record._etag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ private slots:
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
record._path = path;
|
record._path = path;
|
||||||
record._remotePerm = RemotePermissions::fromDbValue("RW");
|
record._remotePerm = RemotePermissions::fromDbValue("RW");
|
||||||
_db.setFileRecord(record);
|
QVERIFY(_db.setFileRecord(record));
|
||||||
};
|
};
|
||||||
|
|
||||||
QByteArrayList elements;
|
QByteArrayList elements;
|
||||||
|
@ -296,8 +296,7 @@ private slots:
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
for (const auto& elem : elements) {
|
for (const auto& elem : elements) {
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
_db.getFileRecord(elem, &record);
|
if (!_db.getFileRecord(elem, &record) || !record.isValid()) {
|
||||||
if (!record.isValid()) {
|
|
||||||
qWarning() << "Missing record: " << elem;
|
qWarning() << "Missing record: " << elem;
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
@ -305,17 +304,17 @@ private slots:
|
||||||
return ok;
|
return ok;
|
||||||
};
|
};
|
||||||
|
|
||||||
_db.deleteFileRecord("moo", true);
|
QVERIFY(_db.deleteFileRecord("moo", true));
|
||||||
elements.removeAll("moo");
|
elements.removeAll("moo");
|
||||||
elements.removeAll("moo/file");
|
elements.removeAll("moo/file");
|
||||||
QVERIFY(checkElements());
|
QVERIFY(checkElements());
|
||||||
|
|
||||||
_db.deleteFileRecord("fo_", true);
|
QVERIFY(_db.deleteFileRecord("fo_", true));
|
||||||
elements.removeAll("fo_");
|
elements.removeAll("fo_");
|
||||||
elements.removeAll("fo_/file");
|
elements.removeAll("fo_/file");
|
||||||
QVERIFY(checkElements());
|
QVERIFY(checkElements());
|
||||||
|
|
||||||
_db.deleteFileRecord("foo%bar", true);
|
QVERIFY(_db.deleteFileRecord("foo%bar", true));
|
||||||
elements.removeAll("foo%bar");
|
elements.removeAll("foo%bar");
|
||||||
QVERIFY(checkElements());
|
QVERIFY(checkElements());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ bool itemInstruction(const ItemCompletedSpy &spy, const QString &path, const Syn
|
||||||
SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
|
SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
|
||||||
{
|
{
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
folder.syncJournal().getFileRecord(path, &record);
|
[[maybe_unused]] const auto result = folder.syncJournal().getFileRecord(path, &record);
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ void triggerDownload(FakeFolder &folder, const QByteArray &path)
|
||||||
{
|
{
|
||||||
auto &journal = folder.syncJournal();
|
auto &journal = folder.syncJournal();
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
journal.getFileRecord(path + DVSUFFIX, &record);
|
if (!journal.getFileRecord(path + DVSUFFIX, &record) || !record.isValid()) {
|
||||||
if (!record.isValid())
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
record._type = ItemTypeVirtualFileDownload;
|
record._type = ItemTypeVirtualFileDownload;
|
||||||
journal.setFileRecord(record);
|
QVERIFY(journal.setFileRecord(record));
|
||||||
journal.schedulePathForRemoteDiscovery(record._path);
|
journal.schedulePathForRemoteDiscovery(record._path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@ void markForDehydration(FakeFolder &folder, const QByteArray &path)
|
||||||
{
|
{
|
||||||
auto &journal = folder.syncJournal();
|
auto &journal = folder.syncJournal();
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
journal.getFileRecord(path, &record);
|
if (!journal.getFileRecord(path, &record) || !record.isValid()) {
|
||||||
if (!record.isValid())
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
record._type = ItemTypeVirtualFileDehydration;
|
record._type = ItemTypeVirtualFileDehydration;
|
||||||
journal.setFileRecord(record);
|
QVERIFY(journal.setFileRecord(record));
|
||||||
journal.schedulePathForRemoteDiscovery(record._path);
|
journal.schedulePathForRemoteDiscovery(record._path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,8 +186,8 @@ private slots:
|
||||||
QVERIFY(fakeFolder.currentLocalState().find("A/a3" DVSUFFIX));
|
QVERIFY(fakeFolder.currentLocalState().find("A/a3" DVSUFFIX));
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
fakeFolder.syncEngine().journal()->deleteFileRecord("A/a2" DVSUFFIX);
|
QVERIFY(fakeFolder.syncEngine().journal()->deleteFileRecord("A/a2" DVSUFFIX));
|
||||||
fakeFolder.syncEngine().journal()->deleteFileRecord("A/a3" DVSUFFIX);
|
QVERIFY(fakeFolder.syncEngine().journal()->deleteFileRecord("A/a3" DVSUFFIX));
|
||||||
fakeFolder.remoteModifier().remove("A/a3");
|
fakeFolder.remoteModifier().remove("A/a3");
|
||||||
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::FilesystemOnly);
|
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::FilesystemOnly);
|
||||||
QVERIFY(fakeFolder.syncOnce());
|
QVERIFY(fakeFolder.syncOnce());
|
||||||
|
@ -431,7 +431,7 @@ private slots:
|
||||||
|
|
||||||
auto cleanup = [&]() {
|
auto cleanup = [&]() {
|
||||||
completeSpy.clear();
|
completeSpy.clear();
|
||||||
fakeFolder.syncJournal().wipeErrorBlacklist();
|
QVERIFY(fakeFolder.syncJournal().wipeErrorBlacklist() != -1);
|
||||||
};
|
};
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
|
@ -964,9 +964,9 @@ private slots:
|
||||||
};
|
};
|
||||||
auto hasDehydratedDbEntries = [&](const QString &path) {
|
auto hasDehydratedDbEntries = [&](const QString &path) {
|
||||||
SyncJournalFileRecord normal, suffix;
|
SyncJournalFileRecord normal, suffix;
|
||||||
fakeFolder.syncJournal().getFileRecord(path, &normal);
|
return (!fakeFolder.syncJournal().getFileRecord(path, &normal) || !normal.isValid())
|
||||||
fakeFolder.syncJournal().getFileRecord(path + DVSUFFIX, &suffix);
|
&& fakeFolder.syncJournal().getFileRecord(path + DVSUFFIX, &suffix) && suffix.isValid()
|
||||||
return !normal.isValid() && suffix.isValid() && suffix._type == ItemTypeVirtualFile;
|
&& suffix._type == ItemTypeVirtualFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
QVERIFY(isDehydrated("A/a1"));
|
QVERIFY(isDehydrated("A/a1"));
|
||||||
|
|
|
@ -45,7 +45,7 @@ bool itemInstruction(const ItemCompletedSpy &spy, const QString &path, const Syn
|
||||||
SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
|
SyncJournalFileRecord dbRecord(FakeFolder &folder, const QString &path)
|
||||||
{
|
{
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
folder.syncJournal().getFileRecord(path, &record);
|
[[maybe_unused]] const auto result = folder.syncJournal().getFileRecord(path, &record);
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ void triggerDownload(FakeFolder &folder, const QByteArray &path)
|
||||||
{
|
{
|
||||||
auto &journal = folder.syncJournal();
|
auto &journal = folder.syncJournal();
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
journal.getFileRecord(path, &record);
|
if (!journal.getFileRecord(path, &record) || !record.isValid()) {
|
||||||
if (!record.isValid())
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
record._type = ItemTypeVirtualFileDownload;
|
record._type = ItemTypeVirtualFileDownload;
|
||||||
journal.setFileRecord(record);
|
QVERIFY(journal.setFileRecord(record));
|
||||||
journal.schedulePathForRemoteDiscovery(record._path);
|
journal.schedulePathForRemoteDiscovery(record._path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ void markForDehydration(FakeFolder &folder, const QByteArray &path)
|
||||||
{
|
{
|
||||||
auto &journal = folder.syncJournal();
|
auto &journal = folder.syncJournal();
|
||||||
SyncJournalFileRecord record;
|
SyncJournalFileRecord record;
|
||||||
journal.getFileRecord(path, &record);
|
if (!journal.getFileRecord(path, &record) || !record.isValid()) {
|
||||||
if (!record.isValid())
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
record._type = ItemTypeVirtualFileDehydration;
|
record._type = ItemTypeVirtualFileDehydration;
|
||||||
journal.setFileRecord(record);
|
QVERIFY(journal.setFileRecord(record));
|
||||||
journal.schedulePathForRemoteDiscovery(record._path);
|
journal.schedulePathForRemoteDiscovery(record._path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +217,8 @@ private slots:
|
||||||
QCOMPARE(dbRecord(fakeFolder, "A/a3")._fileSize, 33);
|
QCOMPARE(dbRecord(fakeFolder, "A/a3")._fileSize, 33);
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
fakeFolder.syncEngine().journal()->deleteFileRecord("A/a2");
|
QVERIFY(fakeFolder.syncEngine().journal()->deleteFileRecord("A/a2"));
|
||||||
fakeFolder.syncEngine().journal()->deleteFileRecord("A/a3");
|
QVERIFY(fakeFolder.syncEngine().journal()->deleteFileRecord("A/a3"));
|
||||||
fakeFolder.remoteModifier().remove("A/a3");
|
fakeFolder.remoteModifier().remove("A/a3");
|
||||||
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::FilesystemOnly);
|
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::FilesystemOnly);
|
||||||
QVERIFY(fakeFolder.syncOnce());
|
QVERIFY(fakeFolder.syncOnce());
|
||||||
|
@ -436,7 +436,7 @@ private slots:
|
||||||
|
|
||||||
auto cleanup = [&]() {
|
auto cleanup = [&]() {
|
||||||
completeSpy.clear();
|
completeSpy.clear();
|
||||||
fakeFolder.syncJournal().wipeErrorBlacklist();
|
QVERIFY(fakeFolder.syncJournal().wipeErrorBlacklist() != -1);
|
||||||
};
|
};
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
|
@ -708,8 +708,7 @@ private slots:
|
||||||
};
|
};
|
||||||
auto hasDehydratedDbEntries = [&](const QString &path) {
|
auto hasDehydratedDbEntries = [&](const QString &path) {
|
||||||
SyncJournalFileRecord rec;
|
SyncJournalFileRecord rec;
|
||||||
fakeFolder.syncJournal().getFileRecord(path, &rec);
|
return fakeFolder.syncJournal().getFileRecord(path, &rec) && rec.isValid() && rec._type == ItemTypeVirtualFile;
|
||||||
return rec.isValid() && rec._type == ItemTypeVirtualFile;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QVERIFY(isDehydrated("A/a1"));
|
QVERIFY(isDehydrated("A/a1"));
|
||||||
|
|
|
@ -48,21 +48,21 @@ private slots:
|
||||||
QCOMPARE(uploadInfo._errorCount, 1);
|
QCOMPARE(uploadInfo._errorCount, 1);
|
||||||
QCOMPARE(uploadInfo._transferid, 1U);
|
QCOMPARE(uploadInfo._transferid, 1U);
|
||||||
|
|
||||||
fakeFolder.syncEngine().journal()->wipeErrorBlacklist();
|
QVERIFY(fakeFolder.syncEngine().journal()->wipeErrorBlacklist());
|
||||||
QVERIFY(!fakeFolder.syncOnce());
|
QVERIFY(!fakeFolder.syncOnce());
|
||||||
|
|
||||||
uploadInfo = fakeFolder.syncEngine().journal()->getUploadInfo("A/a0");
|
uploadInfo = fakeFolder.syncEngine().journal()->getUploadInfo("A/a0");
|
||||||
QCOMPARE(uploadInfo._errorCount, 2);
|
QCOMPARE(uploadInfo._errorCount, 2);
|
||||||
QCOMPARE(uploadInfo._transferid, 1U);
|
QCOMPARE(uploadInfo._transferid, 1U);
|
||||||
|
|
||||||
fakeFolder.syncEngine().journal()->wipeErrorBlacklist();
|
QVERIFY(fakeFolder.syncEngine().journal()->wipeErrorBlacklist());
|
||||||
QVERIFY(!fakeFolder.syncOnce());
|
QVERIFY(!fakeFolder.syncOnce());
|
||||||
|
|
||||||
uploadInfo = fakeFolder.syncEngine().journal()->getUploadInfo("A/a0");
|
uploadInfo = fakeFolder.syncEngine().journal()->getUploadInfo("A/a0");
|
||||||
QCOMPARE(uploadInfo._errorCount, 3);
|
QCOMPARE(uploadInfo._errorCount, 3);
|
||||||
QCOMPARE(uploadInfo._transferid, 1U);
|
QCOMPARE(uploadInfo._transferid, 1U);
|
||||||
|
|
||||||
fakeFolder.syncEngine().journal()->wipeErrorBlacklist();
|
QVERIFY(fakeFolder.syncEngine().journal()->wipeErrorBlacklist());
|
||||||
QVERIFY(!fakeFolder.syncOnce());
|
QVERIFY(!fakeFolder.syncOnce());
|
||||||
|
|
||||||
uploadInfo = fakeFolder.syncEngine().journal()->getUploadInfo("A/a0");
|
uploadInfo = fakeFolder.syncEngine().journal()->getUploadInfo("A/a0");
|
||||||
|
|
Loading…
Reference in a new issue