From 9e24b43cb962d7d0035154a546ef281d0a786162 Mon Sep 17 00:00:00 2001 From: Ryan Chu Date: Wed, 28 Feb 2018 16:48:38 +0100 Subject: Docker-based test servers for network-related Qt autotests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing network test server has some limitations. Most notably, it is not accessible by every Qt developer. Also, some services don't allow simultaneous access, which causes flaky test results. Instead of centralizing all the services to one physical machine, the idea is to build up several dedicated servers inside separate Docker containers. 1. Create testserver.pri and integrate it into the make check command of Qt Test. 2. Define QT_TEST_SERVER flag for changing test parameters at compile time. Task-number: QTQAINFRA-1686 Change-Id: I0422ddb97eb8c11b4818771454851d19671253b1 Reviewed-by: Jędrzej Nowacki Reviewed-by: Ryan Chu --- tests/testserver/squid/squid.sh | 46 ++++++++++++++++++++++ .../squid/testdata/squid-authenticating-ntlm.conf | 41 +++++++++++++++++++ tests/testserver/squid/testdata/squid.conf | 46 ++++++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100755 tests/testserver/squid/squid.sh create mode 100644 tests/testserver/squid/testdata/squid-authenticating-ntlm.conf create mode 100644 tests/testserver/squid/testdata/squid.conf (limited to 'tests/testserver/squid') diff --git a/tests/testserver/squid/squid.sh b/tests/testserver/squid/squid.sh new file mode 100755 index 0000000000..8e413f2f14 --- /dev/null +++ b/tests/testserver/squid/squid.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:GPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 or (at your option) any later version +## approved by the KDE Free Qt Foundation. The licenses are as published by +## the Free Software Foundation and appearing in the file LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +set -ex + +# package squid + +# install configurations and test data +cp $TESTDATA/squid{,-authenticating-ntlm}.conf /etc/squid/ +sed -e 's,NAME=squid,NAME=squid-authenticating-ntlm,' \ + -e 's,CONFIG=/etc/squid/squid.conf,CONFIG=/etc/squid/squid-authenticating-ntlm.conf,' \ + -e 's,SQUID_ARGS="-YC -f $CONFIG",SQUID_ARGS="-D -YC -f $CONFIG",' \ + /etc/init.d/squid >/etc/init.d/squid-authenticating-ntlm +chmod +x /etc/init.d/squid-authenticating-ntlm + +# enable service with installed configurations +service squid start +service squid-authenticating-ntlm start diff --git a/tests/testserver/squid/testdata/squid-authenticating-ntlm.conf b/tests/testserver/squid/testdata/squid-authenticating-ntlm.conf new file mode 100644 index 0000000000..55a74498e9 --- /dev/null +++ b/tests/testserver/squid/testdata/squid-authenticating-ntlm.conf @@ -0,0 +1,41 @@ +pid_filename /var/run/squid-authenticating-ntlm.pid +access_log /var/log/squid/access-authenticating-ntlm.log +cache_log /var/log/squid/cache-authenticating-ntlm.log +cache_store_log /var/log/squid/store-authenticating-ntlm.log +http_port 3130 +hierarchy_stoplist cgi-bin ? +acl QUERY urlpath_regex cgi-bin \? +no_cache deny QUERY +refresh_pattern ^ftp: 1440 20% 10080 +refresh_pattern ^gopher: 1440 0% 1440 +refresh_pattern . 0 20% 4320 +acl port3130 myport 3130 +acl manager proto cache_object +acl localhost src 127.0.0.1/255.255.255.255 +acl to_localhost dst 127.0.0.0/8 +acl SSL_ports port 443 563 +acl Safe_ports port 80 # http +acl Safe_ports port 21 # ftp +acl Safe_ports port 443 563 # https, snews +acl Safe_ports port 70 # gopher +acl Safe_ports port 210 # wais +acl Safe_ports port 1025-65535 # unregistered ports +acl Safe_ports port 280 # http-mgmt +acl Safe_ports port 488 # gss-http +acl Safe_ports port 591 # filemaker +acl Safe_ports port 777 # multiling http +acl CONNECT method CONNECT +http_access allow manager localhost +http_access deny manager +http_access allow localhost + + +# port 3130: ntlm auth +auth_param ntlm program /usr/lib/squid/ntlm_smb_lm_auth --debuglevel=5 --logfile=/var/log/ntlm --log-basename=/var/log/ntlm --helper-protocol=squid-2.5-ntlmssp +auth_param ntlm children 2 +acl ntlm_users proxy_auth REQUIRED +http_access allow port3130 ntlm_users +http_reply_access allow port3130 ntlm_users + +icp_access allow all +coredump_dir /var/cache/squid diff --git a/tests/testserver/squid/testdata/squid.conf b/tests/testserver/squid/testdata/squid.conf new file mode 100644 index 0000000000..da1b13af8c --- /dev/null +++ b/tests/testserver/squid/testdata/squid.conf @@ -0,0 +1,46 @@ +http_port 3128 +http_port 3129 +hierarchy_stoplist cgi-bin ? +acl QUERY urlpath_regex cgi-bin \? +no_cache deny QUERY +refresh_pattern ^ftp: 1440 20% 10080 +refresh_pattern ^gopher: 1440 0% 1440 +refresh_pattern . 0 20% 4320 +acl port3128 myport 3128 +acl port3129 myport 3129 +acl manager proto cache_object +acl localhost src 127.0.0.1/255.255.255.255 +acl to_localhost dst 127.0.0.0/8 +acl SSL_ports port 443 563 +acl Safe_ports port 80 # http +acl Safe_ports port 21 # ftp +acl Safe_ports port 443 563 # https, snews +acl Safe_ports port 70 # gopher +acl Safe_ports port 210 # wais +acl Safe_ports port 1025-65535 # unregistered ports +acl Safe_ports port 280 # http-mgmt +acl Safe_ports port 488 # gss-http +acl Safe_ports port 591 # filemaker +acl Safe_ports port 777 # multiling http +acl CONNECT method CONNECT +http_access allow manager localhost +http_access deny manager +http_access allow localhost + + +# port 3128: no auth required +http_access allow port3128 +http_reply_access allow port3128 + +# port 3129: basic auth +auth_param basic program /usr/lib/squid/basic_ncsa_auth /home/qt-test-server/passwords +auth_param basic children 5 +auth_param basic realm Squid proxy-caching web server +auth_param basic credentialsttl 2 hours +auth_param basic casesensitive off +acl ncsa_users proxy_auth REQUIRED +http_access allow port3129 ncsa_users +http_reply_access allow port3129 ncsa_users + +icp_access allow all +coredump_dir /var/cache/squid -- cgit v1.2.3