diff options
author | MÃ¥rten Nordheim <marten.nordheim@qt.io> | 2021-09-10 11:34:35 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-09-11 07:19:39 +0000 |
commit | d1d0bc1ae548be508f9f09049123067896b9c16e (patch) | |
tree | 6875abf17d58504c2ba63621a1a9f3e16e465b71 /tests | |
parent | 6f60f1783b629f3e52a4418321cc010926ba02f6 (diff) |
tst_http2: Fix flaky authentication test
The h2 server is running in a separate thread, so while the previous
test was finished and the server was deleted, it could still emit
and have a queued emission in-flight which would be picked up by
the next running test.
Change-Id: I26b1bc711df7473032d6078f35f8aca37c40137e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c942bae4ebf903a60a8bd3da9500f7733c71b04d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/network/access/http2/tst_http2.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 392419e066..58affda4a4 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -796,6 +796,7 @@ void tst_Http2::authenticationRequired_data() void tst_Http2::authenticationRequired() { clearHTTP2State(); + serverPort = 0; QFETCH(const bool, responseHEADOnly); POSTResponseHEADOnly = responseHEADOnly; @@ -864,6 +865,10 @@ void tst_Http2::authenticationRequired() QCOMPARE(isAuthenticated(reqAuthHeader), success); if (success) QCOMPARE(receivedBody, expectedBody); + // In the `!success` case we need to wait for the server to emit this or it might cause issues + // in the next test running after this. In the `success` case we anyway expect it to have been + // received. + QTRY_VERIFY(serverGotSettingsACK); } void tst_Http2::serverStarted(quint16 port) |