diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-10-09 17:43:58 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-10-11 08:46:18 +0000 |
commit | a7bfc7ebb30dd45e4692ec38d8b9ede6372939f0 (patch) | |
tree | c48b7d91e6d87b75049b8c2a58e83e36b50b1300 /tests | |
parent | 0a4cf46f4f82d4f6d70640f8a9ba09f8c547c4e1 (diff) |
Fix flaky test casesv5.14.0-beta2
Some tests cases are randomly failing because of the following issues:
- In tst_QCoapClient::removeReply test 'reply' is scheduled for deletion
before calling exec, which causes it to be deleted while the request
is still executing. Schedule it for deletion in the QCoapReply::finished
slot.
- The timeout used in tst_QCoapClient::setMinimumTokenSize sometimes is
not sufficient, increase it.
Fixes: QTBUG-79113
Change-Id: I151380fa4982d8c654550cf64108ab31d9b6f6b2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qcoapclient/tst_qcoapclient.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/qcoapclient/tst_qcoapclient.cpp b/tests/auto/qcoapclient/tst_qcoapclient.cpp index b7844b7..e28a48b 100644 --- a/tests/auto/qcoapclient/tst_qcoapclient.cpp +++ b/tests/auto/qcoapclient/tst_qcoapclient.cpp @@ -433,10 +433,9 @@ void tst_QCoapClient::removeReply() QCoapClient client; QCoapReply *reply = client.get(QUrl(testServerResource())); QVERIFY2(reply != nullptr, "Request failed unexpectedly"); + connect(reply, &QCoapReply::finished, this, [reply]() { reply->deleteLater(); }); try { - reply->deleteLater(); - QEventLoop eventLoop; QTimer::singleShot(2000, &eventLoop, &QEventLoop::quit); eventLoop.exec(); @@ -1109,7 +1108,7 @@ void tst_QCoapClient::setMinimumTokenSize() QScopedPointer<QCoapReply> reply; reply.reset(client.get(QCoapRequest("127.0.0.1"))); - QTRY_COMPARE_WITH_TIMEOUT(spyClientError.count(), 1, 100); + QTRY_COMPARE_WITH_TIMEOUT(spyClientError.count(), 1, 300); QVERIFY(reply->request().tokenLength() >= expectedMinSize); QVERIFY(reply->request().tokenLength() <= maxSize); } |