From 78e167ab7be4da27abda7438994b7b14535d916f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 17 Jul 2024 17:39:01 +0200 Subject: [PATCH] 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 Reviewed-by: Timur Pocheptsov (cherry picked from commit 4e827e42e339a2774be26ba844bd5e87a14d83b5) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/network/access/http2/BLACKLIST | 3 --- tests/auto/network/access/http2/tst_http2.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 tests/auto/network/access/http2/BLACKLIST diff --git a/tests/auto/network/access/http2/BLACKLIST b/tests/auto/network/access/http2/BLACKLIST deleted file mode 100644 index 9d358536123..00000000000 --- a/tests/auto/network/access/http2/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -[duplicateRequestsWithAborts] -qnx ci # QTBUG-119616 -macos arm # QTBUG-119616 diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 7d6d7245415..b58ffabd457 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -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){