Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit 9505513

Browse files
committed
make integration test more robust
1 parent 0c4cf9e commit 9505513

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

tests/auto/datasync/IntegrationTest/tst_integration.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,22 @@ void IntegrationTest::testAddAccount()
236236
QCOMPARE(grantSpy.takeFirst()[0].toUuid(), dev2Id);
237237

238238
//wait for sync
239-
sync1->runOnSynchronized([this](SyncManager::SyncState s) {
240-
emit unlock();
241-
QCOMPARE(s, SyncManager::Synchronized);
242-
}, true);
243-
unlockSpy.wait();
244-
sync2->runOnSynchronized([this](SyncManager::SyncState s) {
245-
emit unlock();
246-
QCOMPARE(s, SyncManager::Synchronized);
247-
});
248-
unlockSpy.wait();
239+
qint64 oldCnt1 = 0;
240+
qint64 oldCnt2 = 0;
241+
do {
242+
oldCnt1 = store1->count();
243+
oldCnt2 = store2->count();
244+
sync1->runOnSynchronized([this](SyncManager::SyncState s) {
245+
emit unlock();
246+
QCOMPARE(s, SyncManager::Synchronized);
247+
}, true);
248+
unlockSpy.wait();
249+
sync2->runOnSynchronized([this](SyncManager::SyncState s) {
250+
emit unlock();
251+
QCOMPARE(s, SyncManager::Synchronized);
252+
});
253+
unlockSpy.wait();
254+
} while(oldCnt1 != store1->count() || oldCnt2 != store2->count());
249255

250256
QCOMPARE(store1->count(), 20);
251257
QCOMPAREUNORDERED(store1->keys(), TestLib::generateDataKeys(0, 19));

0 commit comments

Comments
 (0)