Convert tst_qsslsocket_*_static/member auto-tests
To work with docker test server. Change-Id: I50a1c7b632748d7648dafd70356aa849614e4e12 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
7aa204d5b3
commit
703ca2606f
@ -17,3 +17,9 @@ win32 {
|
|||||||
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
||||||
|
|
||||||
requires(qtConfig(private_tests))
|
requires(qtConfig(private_tests))
|
||||||
|
|
||||||
|
# DOCKERTODO: linux, docker is disabled on macOS/Windows.
|
||||||
|
linux {
|
||||||
|
QT_TEST_SERVER_LIST = squid danted
|
||||||
|
include($$dirname(_QMAKE_CONF_)/tests/auto/testserver.pri)
|
||||||
|
}
|
||||||
|
@ -102,7 +102,15 @@ void tst_QSslSocket_onDemandCertificates_member::initTestCase_data()
|
|||||||
|
|
||||||
void tst_QSslSocket_onDemandCertificates_member::initTestCase()
|
void tst_QSslSocket_onDemandCertificates_member::initTestCase()
|
||||||
{
|
{
|
||||||
|
#ifdef QT_TEST_SERVER
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080));
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1081));
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128));
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129));
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130));
|
||||||
|
#else
|
||||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||||
|
#endif // QT_TEST_SERVER
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QSslSocket_onDemandCertificates_member::init()
|
void tst_QSslSocket_onDemandCertificates_member::init()
|
||||||
@ -110,28 +118,29 @@ void tst_QSslSocket_onDemandCertificates_member::init()
|
|||||||
QFETCH_GLOBAL(bool, setProxy);
|
QFETCH_GLOBAL(bool, setProxy);
|
||||||
if (setProxy) {
|
if (setProxy) {
|
||||||
QFETCH_GLOBAL(int, proxyType);
|
QFETCH_GLOBAL(int, proxyType);
|
||||||
QString testServer = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
|
const auto socksAddr = QtNetworkSettings::socksProxyServerIp().toString();
|
||||||
|
const auto squidAddr = QtNetworkSettings::httpProxyServerIp().toString();
|
||||||
QNetworkProxy proxy;
|
QNetworkProxy proxy;
|
||||||
|
|
||||||
switch (proxyType) {
|
switch (proxyType) {
|
||||||
case Socks5Proxy:
|
case Socks5Proxy:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1080);
|
proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksAddr, 1080);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Socks5Proxy | AuthBasic:
|
case Socks5Proxy | AuthBasic:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1081);
|
proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksAddr, 1081);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HttpProxy | NoAuth:
|
case HttpProxy | NoAuth:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3128);
|
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3128);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HttpProxy | AuthBasic:
|
case HttpProxy | AuthBasic:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3129);
|
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3129);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HttpProxy | AuthNtlm:
|
case HttpProxy | AuthNtlm:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3130);
|
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3130);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QNetworkProxy::setApplicationProxy(proxy);
|
QNetworkProxy::setApplicationProxy(proxy);
|
||||||
|
@ -16,3 +16,9 @@ win32 {
|
|||||||
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
||||||
|
|
||||||
requires(qtConfig(private_tests))
|
requires(qtConfig(private_tests))
|
||||||
|
|
||||||
|
#DOCKERTODO Linux, docker is disabled on macOS and Windows.
|
||||||
|
linux {
|
||||||
|
QT_TEST_SERVER_LIST = squid danted
|
||||||
|
include($$dirname(_QMAKE_CONF_)/tests/auto/testserver.pri)
|
||||||
|
}
|
||||||
|
@ -98,7 +98,15 @@ void tst_QSslSocket_onDemandCertificates_static::initTestCase_data()
|
|||||||
|
|
||||||
void tst_QSslSocket_onDemandCertificates_static::initTestCase()
|
void tst_QSslSocket_onDemandCertificates_static::initTestCase()
|
||||||
{
|
{
|
||||||
|
#ifdef QT_TEST_SERVER
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080));
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1081));
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128));
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129));
|
||||||
|
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130));
|
||||||
|
#else
|
||||||
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
|
||||||
|
#endif // QT_TEST_SERVER
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QSslSocket_onDemandCertificates_static::init()
|
void tst_QSslSocket_onDemandCertificates_static::init()
|
||||||
@ -106,28 +114,30 @@ void tst_QSslSocket_onDemandCertificates_static::init()
|
|||||||
QFETCH_GLOBAL(bool, setProxy);
|
QFETCH_GLOBAL(bool, setProxy);
|
||||||
if (setProxy) {
|
if (setProxy) {
|
||||||
QFETCH_GLOBAL(int, proxyType);
|
QFETCH_GLOBAL(int, proxyType);
|
||||||
QString testServer = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
|
const auto socksAddr = QtNetworkSettings::socksProxyServerIp().toString();
|
||||||
|
const auto squidAddr = QtNetworkSettings::httpProxyServerIp().toString();
|
||||||
|
|
||||||
QNetworkProxy proxy;
|
QNetworkProxy proxy;
|
||||||
|
|
||||||
switch (proxyType) {
|
switch (proxyType) {
|
||||||
case Socks5Proxy:
|
case Socks5Proxy:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1080);
|
proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksAddr, 1080);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Socks5Proxy | AuthBasic:
|
case Socks5Proxy | AuthBasic:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1081);
|
proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, socksAddr, 1081);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HttpProxy | NoAuth:
|
case HttpProxy | NoAuth:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3128);
|
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3128);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HttpProxy | AuthBasic:
|
case HttpProxy | AuthBasic:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3129);
|
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3129);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HttpProxy | AuthNtlm:
|
case HttpProxy | AuthNtlm:
|
||||||
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3130);
|
proxy = QNetworkProxy(QNetworkProxy::HttpProxy, squidAddr, 3130);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QNetworkProxy::setApplicationProxy(proxy);
|
QNetworkProxy::setApplicationProxy(proxy);
|
||||||
|
Loading…
Reference in New Issue
Block a user