tst_QTcpSocket: stabilize connectToHostError

It's not _wrong_ to time out when connecting to something unreachable
(it's just a different way of handling it) so we shouldn't fail when
this happens either.

In local testing (windows) it times out after 8 seconds, so bump
the timer to 10 seconds. On systems where it's faster there'll be
no difference as long as things don't go wrong.

Pick-to: 6.0
Fixes: QTBUG-89089
Change-Id: I8437cf8e4fbecedea2391ed87fdce1213085b964
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Mårten Nordheim 2020-12-03 13:13:20 +01:00
parent af0a9375f3
commit 27f52942b4

View File

@ -2126,8 +2126,8 @@ void tst_QTcpSocket::connectToHostError()
});
socket->connectToHost(host, port);
eventLoop.enterLoopMSecs(7000);
if (eventLoop.timeout() && port == 65000) {
eventLoop.enterLoopMSecs(10'000);
if (eventLoop.timeout()) {
// Let's at least verify it's not in connected state:
QVERIFY(socket->state() != QAbstractSocket::ConnectedState);
QSKIP("Connection to unreachable host timed out, skipping the rest of the test");