Fix SyncEngineTest failure when localstate is destroyed.

Signed-off-by: alex-z <blackslayer4@gmail.com>
This commit is contained in:
alex-z 2022-12-13 14:41:07 +01:00 committed by backportbot-nextcloud[bot]
parent 012f91495d
commit ec58a2d716
1 changed files with 9 additions and 5 deletions

View File

@ -1257,9 +1257,11 @@ private slots:
fakeFolder.syncEngine().setLocalDiscoveryOptions(OCC::LocalDiscoveryStyle::DatabaseAndFilesystem);
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
auto localState = fakeFolder.currentLocalState();
QCOMPARE(localState, fakeFolder.currentRemoteState());
QCOMPARE(printDbData(fakeFolder.dbState()), printDbData(fakeFolder.currentRemoteState()));
const auto fileFirstSync = fakeFolder.currentLocalState().find(testFile);
const auto fileFirstSync = localState.find(testFile);
QVERIFY(fileFirstSync);
QCOMPARE(fileFirstSync->lastModified.toSecsSinceEpoch(), CURRENT_MTIME - 2);
@ -1267,9 +1269,10 @@ private slots:
fakeFolder.syncEngine().setLocalDiscoveryOptions(OCC::LocalDiscoveryStyle::FilesystemOnly);
QVERIFY(fakeFolder.syncOnce());
localState = fakeFolder.currentLocalState();
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
QCOMPARE(printDbData(fakeFolder.dbState()), printDbData(fakeFolder.currentRemoteState()));
const auto fileSecondSync = fakeFolder.currentLocalState().find(testFile);
const auto fileSecondSync = localState.find(testFile);
QVERIFY(fileSecondSync);
QCOMPARE(fileSecondSync->lastModified.toSecsSinceEpoch(), CURRENT_MTIME - 1);
@ -1277,9 +1280,10 @@ private slots:
fakeFolder.syncEngine().setLocalDiscoveryOptions(OCC::LocalDiscoveryStyle::FilesystemOnly);
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
localState = fakeFolder.currentLocalState();
QCOMPARE(localState, fakeFolder.currentRemoteState());
QCOMPARE(printDbData(fakeFolder.dbState()), printDbData(fakeFolder.currentRemoteState()));
const auto fileThirdSync = fakeFolder.currentLocalState().find(testFile);
const auto fileThirdSync = localState.find(testFile);
QVERIFY(fileThirdSync);
QCOMPARE(fileThirdSync->lastModified.toSecsSinceEpoch(), CURRENT_MTIME);
}