summaryrefslogtreecommitdiffstats
path: root/tests/testserver/common
diff options
context:
space:
mode:
authorRyan Chu <ryan.chu@qt.io>2018-02-28 16:48:38 +0100
committerRyan Chu <ryan.chu@qt.io>2018-07-05 14:13:36 +0000
commit9e24b43cb962d7d0035154a546ef281d0a786162 (patch)
treeb6ff855327bde315a0e6066c13c2b73881abb844 /tests/testserver/common
parent7cd7d6ab3fbfffff8707271c03bb01bcbe5a6d45 (diff)
Docker-based test servers for network-related Qt autotests
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 <jedrzej.nowacki@qt.io> Reviewed-by: Ryan Chu <ryan.chu@qt.io>
Diffstat (limited to 'tests/testserver/common')
-rwxr-xr-xtests/testserver/common/ssl.sh39
-rwxr-xr-xtests/testserver/common/startup.sh52
-rw-r--r--tests/testserver/common/testdata/ssl/private/qt-test-server-key.pem15
-rw-r--r--tests/testserver/common/testdata/ssl/qt-test-server-cert.pem16
-rw-r--r--tests/testserver/common/testdata/system/passwords12
5 files changed, 134 insertions, 0 deletions
diff --git a/tests/testserver/common/ssl.sh b/tests/testserver/common/ssl.sh
new file mode 100755
index 0000000000..8a4728ad4d
--- /dev/null
+++ b/tests/testserver/common/ssl.sh
@@ -0,0 +1,39 @@
+#!/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 ssl
+
+# install ssl_certs and test data
+su $USER -c "mkdir -p -m 700 ~/ssl-certs/private"
+su $USER -c "cp $CONFIG/ssl/qt-test-server-cert.pem ~/ssl-certs/"
+su $USER -c "cp $CONFIG/ssl/private/qt-test-server-key.pem ~/ssl-certs/private/"
diff --git a/tests/testserver/common/startup.sh b/tests/testserver/common/startup.sh
new file mode 100755
index 0000000000..10847d3524
--- /dev/null
+++ b/tests/testserver/common/startup.sh
@@ -0,0 +1,52 @@
+#!/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
+
+# export variables
+export USER=qt-test-server
+export PASS=password
+export CONFIG=common/testdata
+export TESTDATA=service/testdata
+
+# add users
+useradd -m -s /bin/bash $USER; echo "$USER:$PASS" | chpasswd
+
+# install configurations and test data
+su $USER -c "cp $CONFIG/system/passwords ~/"
+
+# modules initialization (apache2.sh, ftp-proxy.sh ...)
+for RUN_CMD
+do $RUN_CMD
+done
+
+# keep-alive in docker detach mode
+sleep infinity
diff --git a/tests/testserver/common/testdata/ssl/private/qt-test-server-key.pem b/tests/testserver/common/testdata/ssl/private/qt-test-server-key.pem
new file mode 100644
index 0000000000..8b7ce5811a
--- /dev/null
+++ b/tests/testserver/common/testdata/ssl/private/qt-test-server-key.pem
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXgIBAAKBgQDNqttv1jTJp/HAvuRBGBniAski5qfVugMunih69F8ad193qRE7
+j37wLsae6zrZEtfBDFHoJFI/I8NCDBHG8hyhQv60wmmDrfdwsRgVzCAoYjDwLBXm
+Mxmvw+scwJH3EWiUUPhJNwgy1z5136O8aQAV3s2HD1wCa4LIAX1q8B3ccwIDAQAB
+AoGAGiDou+6UykHB3uDhkruDHkmIUBzJmceF+/gv4F8Hbg9YW5VpEQ4L7Guk5C+y
+TD2ul2H/TeS/ZjIe7lcmMwYzSLcyeKfaiaV1EhPGjIdvB4ysTN79pfWXQtlpt/Z9
+I/EOoW9XosJ/EOFdpgV0MC9QMTQKMyS0qQLwhBsoAW4DcEECQQDmrWEPNprbEDIH
+Sm+KlMH6rdybIvzR3IPlYE6kMjQIWbUmGNxSUT7B/UDh2QeaTT54Rb1Ygnq7gVjC
+RHU3wnGxAkEA5D6jI/E/xtQSq0KKVpbOxN1dIo0MVPbO/hI7/pO2DdZIM0O4GL55
+ks83O5ZDTfrVy2Ys/9lqbbq+5FSs+NZ1YwJBANzAXRsO+YDcbdP2Uun+0+fOjEhW
+YjV/XyWaVYfil1LKboXn0qhgIbvJXVcEt7bdZwP4UWwracKY1NUMaFSVGvECQQC/
+L3iX8szpT1sT+XjHbytj28jX2C4sPVDFoaB/bltg280+o8rhbyuGvewWDZfzCdlr
+tvqalROBNpwPxp3dEkbhAkEAl7N7/7hWbw7Xv69ww7i0jcPduukbtbEY1DTmARhR
+rOF5AiztOAe+R94iLzkj63ZU0LcoSAixehp2tdkdtTI4CQ==
+-----END RSA PRIVATE KEY-----
diff --git a/tests/testserver/common/testdata/ssl/qt-test-server-cert.pem b/tests/testserver/common/testdata/ssl/qt-test-server-cert.pem
new file mode 100644
index 0000000000..dae5641a88
--- /dev/null
+++ b/tests/testserver/common/testdata/ssl/qt-test-server-cert.pem
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICiTCCAfICCQCqBnF3SPSY7jANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEChMC
+UXQxGTAXBgNVBAsTEENvcmUgQW5kIE5ldHdvcmsxGzAZBgkqhkiG9w0BCQEWDG5v
+Ym9keS5xdC5pbzENMAsGA1UEBxMET3NsbzENMAsGA1UECBMET3NsbzELMAkGA1UE
+BhMCTk8xFjAUBgNVBAMUDSoudGVzdC1uZXQucXQwHhcNMTgwMzEzMDkyNjQ0WhcN
+NDgwMzA1MDkyNjQ0WjCBiDELMAkGA1UEChMCUXQxGTAXBgNVBAsTEENvcmUgQW5k
+IE5ldHdvcmsxGzAZBgkqhkiG9w0BCQEWDG5vYm9keS5xdC5pbzENMAsGA1UEBxME
+T3NsbzENMAsGA1UECBMET3NsbzELMAkGA1UEBhMCTk8xFjAUBgNVBAMUDSoudGVz
+dC1uZXQucXQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM2q22/WNMmn8cC+
+5EEYGeICySLmp9W6Ay6eKHr0Xxp3X3epETuPfvAuxp7rOtkS18EMUegkUj8jw0IM
+EcbyHKFC/rTCaYOt93CxGBXMIChiMPAsFeYzGa/D6xzAkfcRaJRQ+Ek3CDLXPnXf
+o7xpABXezYcPXAJrgsgBfWrwHdxzAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAwNhw
+aKznTaMj6JeHP/kEEwMppRkNjmh4ECdQfT9vYNs45UKSAvCa1dn6ZBZKIdhqKCLn
+U2qiIS2783IoisRjFtg8x70S13EsBw/yEL/av+Ca1gQHOIFrOuLqwYbslTHrRXRA
+RPzHOl3ZP9FD3mPZ8jyzxYs4x5EM0X26FkAR078=
+-----END CERTIFICATE-----
diff --git a/tests/testserver/common/testdata/system/passwords b/tests/testserver/common/testdata/system/passwords
new file mode 100644
index 0000000000..4e911b3f0e
--- /dev/null
+++ b/tests/testserver/common/testdata/system/passwords
@@ -0,0 +1,12 @@
+# user: foo; passwd: bar
+foo:bab.5ZXQdbvEo
+
+# user: qsockstest; passwd: qsockstest
+#qsockstest:S7oOqMpoG6aTk
+
+# user: qsockstest; passwd: password
+qsockstest:Cd3Lv2aD0aiBs
+
+#user httptest password httptest
+httptest:v2fwkDMgrRjRA
+# added by mgoetz for tst_qnetworkreply ioPostToHttpFromSocket