qt5base-lts/tests/auto/network/access
Timur Pocheptsov 0f3c9782e6 tst_QNetworkReply::ioHttpRedirectErrors - fix a flaky test
This test became a real pain recently. A close look at the test shows
several problems (strangely enough, the failure can never be
reproduced on real machines, only on VM - Ubuntu and RHEL 6.6).
There are several asserts that are firing from time to time here and
there. They show that the logic in test is broken/incorrect. QNAM can
open several connections to a host, our test then incorrectly resets
its 'client' data-member and bad things can later happen after
'bytesWrittenSlot' executed (and deleted a socket). For example,
I can reproduce this scenario in every second run:

1. incoming connection -> client = socket(descriptor), connect to
   client's readyRead (s1)
2. incoming connection -> client = socket(descriptor), connect to
   client's readyRead (s2)
QNAM sends a request on s1. We reply on s2 (which is already wrong)
and call client->deleteLater(), which resets client to nullptr.
If QNAM sends something else on s1, we hit assert(!client.isNull()).

To avoid this, whenever 'sender' in any slot is different from the
'client', we use the actual 'sender' to reply. Another problem is this
weird and rather cryptic waitForFinish which is not needed in this
particular test since we wait for reply error, not 'finished'.

As it happened before - it's not clear if these two problems
were the cause of guaranteed fails on CI - an integration failed
~10 times in a row in the same test (not happening anymore though).

Task-number: QTBUG-64569
Change-Id: Id9aa091290350c61fadf1c3c001e7c2e1b5ac8f4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2017-11-22 13:47:30 +00:00
..
hpack HPACK implementation 2016-06-15 11:26:45 +00:00
hsts Add HTTP strict tranport security support to QNAM 2017-01-20 08:41:50 +00:00
http2 Fix some MSVC warnings in tests 2017-06-28 17:58:13 +00:00
qabstractnetworkcache qabstractnetworkcache - enable several tests 2016-01-26 13:12:03 +00:00
qftp Convert features.socks5 to QT_[REQUIRE_]CONFIG 2017-09-06 06:50:54 +00:00
qhttpnetworkconnection Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00
qhttpnetworkreply Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00
qnetworkaccessmanager Updated license headers 2016-01-21 18:55:18 +00:00
qnetworkcachemetadata Updated license headers 2016-01-21 18:55:18 +00:00
qnetworkcookie Add qtest_network.h 2016-09-29 21:46:19 +00:00
qnetworkcookiejar Fix cookie path matching for empty url path 2017-10-19 12:51:38 +00:00
qnetworkdiskcache Updated license headers 2016-01-21 18:55:18 +00:00
qnetworkreply tst_QNetworkReply::ioHttpRedirectErrors - fix a flaky test 2017-11-22 13:47:30 +00:00
qnetworkrequest Add qtest_network.h 2016-09-29 21:46:19 +00:00
spdy Updated license headers 2016-01-21 18:55:18 +00:00
access.pro Add HTTP strict tranport security support to QNAM 2017-01-20 08:41:50 +00:00