tst_http2: stabilize duplicateRequestsWithAborts for macos

The test relies on things ending up in the h2RequestsToSend container
internally. For h2c we would have to use the http1 upgrade mechanism,
and while I have not verified it, it seems to not reliably put
enough requests in the container, and so the test is flaky for macos,
which is the only platform where we use h2c. In CI at least.

Fix it by forcing it by using h2 direct, which will work even on macOS
without server-side ALPN.

Pick-to: 6.7 6.5 6.2
Change-Id: I55816d400baa831524100f075e1b50fd3d9781a6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4e827e42e339a2774be26ba844bd5e87a14d83b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2024-07-17 17:39:01 +02:00 committed by Qt Cherry-pick Bot
parent 3f89719a4b
commit 78e167ab7b
2 changed files with 4 additions and 7 deletions

View File

@ -1,3 +0,0 @@
[duplicateRequestsWithAborts]
qnx ci # QTBUG-119616
macos arm # QTBUG-119616

View File

@ -1481,7 +1481,8 @@ void tst_Http2::duplicateRequestsWithAborts()
clearHTTP2State();
serverPort = 0;
ServerPtr targetServer(newServer(defaultServerSettings, defaultConnectionType()));
H2Type connectionType = H2Type::h2Direct;
ServerPtr targetServer(newServer(defaultServerSettings, connectionType));
QMetaObject::invokeMethod(targetServer.data(), "startServer", Qt::QueuedConnection);
runEventLoop();
@ -1491,10 +1492,9 @@ void tst_Http2::duplicateRequestsWithAborts()
constexpr int ExpectedSuccessfulRequests = 1;
nRequests = ExpectedSuccessfulRequests;
const auto url = requestUrl(defaultConnectionType());
const auto url = requestUrl(connectionType);
QNetworkRequest request(url);
// H2C might be used on macOS where SecureTransport doesn't support server-side ALPN
request.setAttribute(QNetworkRequest::Http2CleartextAllowedAttribute, true);
request.setAttribute(QNetworkRequest::Http2DirectAttribute, true);
qint32 finishedCount = 0;
auto connectToSlots = [this, &finishedCount](QNetworkReply *reply){