autotests fixes
tests / package-smoke-linux (push) Skipped
tests / package-smoke-windows (push) Skipped
tests / macos (push) Successful in 1m22s
tests / linux (pull_request) Successful in 1m54s
tests / package-smoke-macos (push) Skipped
tests / linux (push) Successful in 2m43s
tests / windows (push) Successful in 4m13s
tests / windows (pull_request) Skipped
tests / macos (pull_request) Skipped
tests / package-smoke-linux (pull_request) Skipped
tests / package-smoke-windows (pull_request) Skipped
tests / package-smoke-macos (pull_request) Skipped

Signed-off-by: galeon <dertiellis@gmail.com>
This commit is contained in:
galeon committed 2026-11-01 21:07:03 +03:00
1 parent 6a2b596f32
commit 5635dcc558
11 files changed
+134 -52

No files matched your search

+24 -10
View File
@@ -3,6 +3,7 @@
#include "testenv.h"
#include "fakeinternet.h"
#include "nettest.h"
#include <QNetworkAccessManager>
#include <QNetworkReply>
@@ -30,9 +31,7 @@ class TestFakeInternet : public QObject
private slots:
void initTestCase()
{
QString error;
if (!m_net.start(&error))
QSKIP(qPrintable(QStringLiteral("FakeInternet недоступен: ") + error));
BILAUNCHER_START_FAKE_INTERNET(m_net);
}
void init() { m_net.reset(); }
@@ -100,12 +99,6 @@ private slots:
response.drop = true;
return response;
}());
m_net.route(QStringLiteral("https://a.test/short"), [] {
FakeResponse response = FakeResponse::bytes(QByteArray(1000, 'x'));
response.truncateTo = 10;
return response;
}());
QNetworkAccessManager manager;
QScopedPointer<QNetworkReply> r500(get(manager, QStringLiteral("https://a.test/500")));
QVERIFY(waitFinished(r500.data()));
@@ -114,10 +107,31 @@ private slots:
QScopedPointer<QNetworkReply> drop(get(manager, QStringLiteral("https://a.test/drop")));
QVERIFY(waitFinished(drop.data()));
QVERIFY(drop->error() != QNetworkReply::NoError);
}
void truncatedResponse_data()
{
QTest::addColumn<int>("bytes");
QTest::newRow("empty") << 0;
QTest::newRow("short") << 10;
QTest::newRow("multiple-tls-records") << 65536;
QTest::newRow("last-byte-missing") << 256 * 1024 - 1;
}
void truncatedResponse()
{
QFETCH(int, bytes);
const QByteArray body(256 * 1024, 'x');
FakeResponse cut = FakeResponse::bytes(body);
cut.truncateTo = bytes;
m_net.route(QStringLiteral("https://a.test/short"), cut);
QNetworkAccessManager manager;
QScopedPointer<QNetworkReply> shortReply(get(manager, QStringLiteral("https://a.test/short")));
QVERIFY(waitFinished(shortReply.data()));
QVERIFY2(waitFinished(shortReply.data()),
qPrintable(m_net.diagnostics() + "\nClient: " + shortReply->errorString()));
QVERIFY(shortReply->error() != QNetworkReply::NoError);
QCOMPARE(shortReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
QCOMPARE(shortReply->readAll(), body.left(bytes));
}
void plainHttpThroughProxy()