diff --git a/test/core/core_online_test.cpp b/test/core/core_online_test.cpp index afd8af7e5..fd5d496d6 100644 --- a/test/core/core_online_test.cpp +++ b/test/core/core_online_test.cpp @@ -54,9 +54,8 @@ QList MockNodeListGenerator::getBootstrapnodes() const { } namespace { - const int bootstrap_timeout = 120000; // timeout for bootstrapping - const int local_timeout = 500; // timeout for operations happening offline - const int connected_message_timeout = 15000; // timeout for alice and bob messaging + const int very_long_timeout = 10 * 60 * 1000; + const int connected_message_wait = 15000; // timeout for alice and bob messaging } class TestCoreOnline : public QObject @@ -104,7 +103,7 @@ void TestCoreOnline::init() bob->start(); // Wait for both instances coming online - QTRY_VERIFY_WITH_TIMEOUT(spyAliceOnline.count() >= 1 && spyBobOnline.count() >= 1, bootstrap_timeout); + QTRY_VERIFY_WITH_TIMEOUT(spyAliceOnline.count() >= 1 && spyBobOnline.count() >= 1, very_long_timeout); // Make a friend request from alice to bob const QLatin1String friendMsg{"Test Invite Message"}; @@ -114,7 +113,7 @@ void TestCoreOnline::init() alice->requestFriendship(bob->getSelfId(), friendMsg); // Wait for friend message to be received - QTRY_VERIFY_WITH_TIMEOUT(spyBobFriendMsg.count() == 1 && spyAliceFriendMsg.count() == 1, bootstrap_timeout); + QTRY_VERIFY_WITH_TIMEOUT(spyBobFriendMsg.count() == 1 && spyAliceFriendMsg.count() == 1, very_long_timeout); // Check for expected signal content QVERIFY(qvariant_cast(spyBobFriendMsg[0][0]) == alice->getSelfPublicKey()); @@ -130,7 +129,7 @@ void TestCoreOnline::init() QSignalSpy spyAliceFriendOnline(alice.get(), &Core::friendStatusChanged); QSignalSpy spyBobFriendOnline(bob.get(), &Core::friendStatusChanged); - QTRY_VERIFY_WITH_TIMEOUT(spyAliceFriendOnline.count() >= 1 && spyBobFriendOnline.count() >= 1, bootstrap_timeout); + QTRY_VERIFY_WITH_TIMEOUT(spyAliceFriendOnline.count() >= 1 && spyBobFriendOnline.count() >= 1, very_long_timeout); // Check for expected signal content QVERIFY(spyAliceFriendOnline[0][0].toInt() == static_cast(Status::Status::Online)); @@ -154,20 +153,20 @@ void TestCoreOnline::change_name() alice->setUsername(aliceName); - QTRY_VERIFY_WITH_TIMEOUT(aliceSaveRequest.count() == 1, local_timeout); + QTRY_VERIFY_WITH_TIMEOUT(aliceSaveRequest.count() == 1, very_long_timeout); QTRY_VERIFY_WITH_TIMEOUT(aliceUsernameChanged.count() == 1 && aliceUsernameChanged[0][0].toString() == aliceName, - local_timeout); + very_long_timeout); QTRY_VERIFY_WITH_TIMEOUT(bobUsernameChangeReceived.count() == 1 && - bobUsernameChangeReceived[0][1].toString() == aliceName, connected_message_timeout); + bobUsernameChangeReceived[0][1].toString() == aliceName, very_long_timeout); // Setting the username again to the same value shoud NOT trigger any signals alice->setUsername(aliceName); // Need to sleep here, because we're testing that these don't increase based on // Alice re-setting her username, so QTRY_VERIFY_WITH_TIMEOUT would return immediately. - QTest::qSleep(connected_message_timeout); + QTest::qSleep(connected_message_wait); QVERIFY(aliceSaveRequest.count() == 1); QVERIFY(aliceUsernameChanged.count() == 1); QVERIFY(bobUsernameChangeReceived.count() == 1); @@ -184,20 +183,20 @@ void TestCoreOnline::change_status_message() alice->setStatusMessage(aliceStatusMsg); - QTRY_VERIFY_WITH_TIMEOUT(aliceSaveRequest.count() == 1, local_timeout); + QTRY_VERIFY_WITH_TIMEOUT(aliceSaveRequest.count() == 1, very_long_timeout); QTRY_VERIFY_WITH_TIMEOUT(aliceStatusMsgChanged.count() == 1 && aliceStatusMsgChanged[0][0].toString() == aliceStatusMsg, - local_timeout); + very_long_timeout); QTRY_VERIFY_WITH_TIMEOUT(bobStatusMsgChangeReceived.count() == 1 && - bobStatusMsgChangeReceived[0][1].toString() == aliceStatusMsg, connected_message_timeout); + bobStatusMsgChangeReceived[0][1].toString() == aliceStatusMsg, very_long_timeout); // Setting the status message again to the same value shoud NOT trigger any signals alice->setStatusMessage(aliceStatusMsg); // Need to sleep here, because we're testing that these don't increase based on // Alice re-setting her status message, so QTRY_VERIFY_WITH_TIMEOUT would return immediately. - QTest::qSleep(connected_message_timeout); + QTest::qSleep(connected_message_wait); QVERIFY(aliceSaveRequest.count() == 1); QVERIFY(aliceStatusMsgChanged.count() == 1); QVERIFY(bobStatusMsgChangeReceived.count() == 1); @@ -211,27 +210,27 @@ void TestCoreOnline::change_status() alice->setStatus(Status::Status::Away); - QTRY_VERIFY_WITH_TIMEOUT(aliceSaveRequest.count() == 1, local_timeout); + QTRY_VERIFY_WITH_TIMEOUT(aliceSaveRequest.count() == 1, very_long_timeout); QTRY_VERIFY_WITH_TIMEOUT(aliceStatusChanged.count() == 1 && qvariant_cast(aliceStatusChanged[0][0]) == Status::Status::Away, - local_timeout); + very_long_timeout); QTRY_VERIFY_WITH_TIMEOUT(bobStatusChangeReceived.count() == 1 && qvariant_cast(bobStatusChangeReceived[0][1]) == Status::Status::Away, - connected_message_timeout); + very_long_timeout); // Setting the status message again to the same value again triggers all signals alice->setStatus(Status::Status::Away); // TODO(sudden6): Emitting these again odd and should probably be changed, lets codify it for now though - QTRY_VERIFY_WITH_TIMEOUT(aliceSaveRequest.count() == 2, local_timeout); + QTRY_VERIFY_WITH_TIMEOUT(aliceSaveRequest.count() == 2, very_long_timeout); QTRY_VERIFY_WITH_TIMEOUT(aliceStatusChanged.count() == 2 && qvariant_cast(aliceStatusChanged[1][0]) == Status::Status::Away, - local_timeout); + very_long_timeout); // Need to sleep here, because we're testing that we don't get a new signal for the re-set but // unchanged status, so QTRY_VERIFY_WITH_TIMEOUT would return immediately. - QTest::qSleep(connected_message_timeout); + QTest::qSleep(connected_message_wait); QVERIFY(bobStatusChangeReceived.count() == 1); }