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>
This commit is contained in:
parent
1fa6f1dcf6
commit
7c5c548869
@ -916,6 +916,7 @@ void tst_Http2::authenticationRequired_data()
|
||||
void tst_Http2::authenticationRequired()
|
||||
{
|
||||
clearHTTP2State();
|
||||
serverPort = 0;
|
||||
QFETCH(const bool, responseHEADOnly);
|
||||
POSTResponseHEADOnly = responseHEADOnly;
|
||||
|
||||
@ -983,6 +984,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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user