Convert tst_qudpsocket to use docker
Currently docker is only used for the "echo" test, and then only the echo server. The SOCKS5 tests have been disabled from when our current test server was new. Change-Id: I21b0c5f10e722a42a0880b2500d1bcbc609a03bf Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
c212128a67
commit
ca037c0631
@ -17,3 +17,9 @@ win32 {
|
||||
}
|
||||
|
||||
TARGET = tst_qudpsocket
|
||||
|
||||
# Only on Linux until 'echo' has been added to docker-compose-for-{windows,macOS}.yml and tested
|
||||
linux {
|
||||
QT_TEST_SERVER_LIST = danted echo
|
||||
include($$dirname(_QMAKE_CONF_)/tests/auto/testserver.pri)
|
||||
}
|
||||
|
@ -235,6 +235,7 @@ void tst_QUdpSocket::initTestCase_data()
|
||||
// hack: we only enable the Socks5 over UDP tests on the old
|
||||
// test server, because they fail on the new one. See QTBUG-35490
|
||||
bool newTestServer = true;
|
||||
#ifndef QT_TEST_SERVER
|
||||
QTcpSocket socket;
|
||||
socket.connectToHost(QtNetworkSettings::serverName(), 22);
|
||||
if (socket.waitForConnected(10000)) {
|
||||
@ -244,6 +245,7 @@ void tst_QUdpSocket::initTestCase_data()
|
||||
newTestServer = false;
|
||||
socket.disconnectFromHost();
|
||||
}
|
||||
#endif
|
||||
|
||||
QTest::addColumn<bool>("setProxy");
|
||||
QTest::addColumn<int>("proxyType");
|
||||
@ -257,8 +259,13 @@ void tst_QUdpSocket::initTestCase_data()
|
||||
|
||||
void tst_QUdpSocket::initTestCase()
|
||||
{
|
||||
#ifdef QT_TEST_SERVER
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080));
|
||||
QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::echoServerName(), 7));
|
||||
#else
|
||||
if (!QtNetworkSettings::verifyTestNetworkSettings())
|
||||
QSKIP("No network test server available");
|
||||
#endif
|
||||
allAddresses = QNetworkInterface::allAddresses();
|
||||
m_skipUnsupportedIPv6Tests = shouldSkipIpv6TestsForBrokenSetsockopt();
|
||||
|
||||
@ -300,7 +307,7 @@ void tst_QUdpSocket::init()
|
||||
#if QT_CONFIG(socks5)
|
||||
QFETCH_GLOBAL(int, proxyType);
|
||||
if (proxyType == QNetworkProxy::Socks5Proxy) {
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::socksProxyServerName(), 1080));
|
||||
}
|
||||
#else
|
||||
QSKIP("No proxy support");
|
||||
@ -981,7 +988,7 @@ void tst_QUdpSocket::writeDatagramToNonExistingPeer_data()
|
||||
QTest::addColumn<bool>("bind");
|
||||
QTest::addColumn<QHostAddress>("peerAddress");
|
||||
QHostAddress localhost(QHostAddress::LocalHost);
|
||||
QList<QHostAddress> serverAddresses(QHostInfo::fromName(QtNetworkSettings::serverName()).addresses());
|
||||
QList<QHostAddress> serverAddresses(QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses());
|
||||
if (serverAddresses.isEmpty())
|
||||
return;
|
||||
|
||||
@ -995,7 +1002,7 @@ void tst_QUdpSocket::writeDatagramToNonExistingPeer_data()
|
||||
|
||||
void tst_QUdpSocket::writeDatagramToNonExistingPeer()
|
||||
{
|
||||
if (QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().isEmpty())
|
||||
if (QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses().isEmpty())
|
||||
QFAIL("Could not find test server address");
|
||||
QFETCH(bool, bind);
|
||||
QFETCH(QHostAddress, peerAddress);
|
||||
@ -1015,7 +1022,7 @@ void tst_QUdpSocket::writeToNonExistingPeer_data()
|
||||
{
|
||||
QTest::addColumn<QHostAddress>("peerAddress");
|
||||
QHostAddress localhost(QHostAddress::LocalHost);
|
||||
QList<QHostAddress> serverAddresses(QHostInfo::fromName(QtNetworkSettings::serverName()).addresses());
|
||||
QList<QHostAddress> serverAddresses(QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses());
|
||||
if (serverAddresses.isEmpty())
|
||||
return;
|
||||
|
||||
@ -1028,7 +1035,7 @@ void tst_QUdpSocket::writeToNonExistingPeer_data()
|
||||
void tst_QUdpSocket::writeToNonExistingPeer()
|
||||
{
|
||||
QSKIP("Connected-mode UDP sockets and their behaviour are erratic");
|
||||
if (QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().isEmpty())
|
||||
if (QHostInfo::fromName(QtNetworkSettings::socksProxyServerName()).addresses().isEmpty())
|
||||
QFAIL("Could not find test server address");
|
||||
QFETCH(QHostAddress, peerAddress);
|
||||
quint16 peerPort = 34534;
|
||||
@ -1551,7 +1558,7 @@ void tst_QUdpSocket::echo_data()
|
||||
void tst_QUdpSocket::echo()
|
||||
{
|
||||
QFETCH(bool, connect);
|
||||
QHostInfo info = QHostInfo::fromName(QtNetworkSettings::serverName());
|
||||
QHostInfo info = QHostInfo::fromName(QtNetworkSettings::echoServerName());
|
||||
QVERIFY(info.addresses().count());
|
||||
QHostAddress remote = info.addresses().first();
|
||||
|
||||
|
@ -80,6 +80,7 @@ services:
|
||||
- vsftpd:vsftpd.${TEST_DOMAIN}
|
||||
- ftp-proxy:ftp-proxy.${TEST_DOMAIN}
|
||||
- cyrus:cyrus.${TEST_DOMAIN}
|
||||
- echo:echo.${TEST_DOMAIN}
|
||||
volumes:
|
||||
- ./common:/common:ro
|
||||
- ./danted:/service:ro
|
||||
@ -110,3 +111,14 @@ services:
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
|
||||
echo:
|
||||
image: qt-test-server-echo:b29ad409e746a834c1055fd0f7a55fd5056da6ea
|
||||
container_name: qt-test-server-echo
|
||||
domainname: ${TEST_DOMAIN}
|
||||
hostname: echo
|
||||
volumes:
|
||||
- ./common:/common:ro
|
||||
- ./echo:/service:ro
|
||||
entrypoint: common/startup.sh
|
||||
command: service/echo.sh
|
||||
|
6
tests/testserver/echo/echo.sh
Executable file
6
tests/testserver/echo/echo.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Disabled by default, enable it.
|
||||
sed -i 's/disable\t\t= yes/disable = no/' /etc/xinetd.d/echo
|
||||
|
||||
service xinetd restart
|
Loading…
Reference in New Issue
Block a user