From beab266977c858950bfaa5c2c0d624cb6730f1bc Mon Sep 17 00:00:00 2001 From: Ryan Chu Date: Tue, 27 Nov 2018 22:04:02 +0100 Subject: Docker-based test servers for network-related Qt autotests on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no docker bridge on Windows. Docker document recommends using port mapping to connect to a container. The problem is that it causes a port conflict if the user is running a service that binds the same port on the host. This change applies the same solution of macOS to deploy the docker environment into VirtualBox and use the host network option. Task-number: QTQAINFRA-2294 Change-Id: Iedcb8daa39373f02adb59f02eae2775f02870c54 Reviewed-by: Jędrzej Nowacki Reviewed-by: Edward Welbourne --- tests/testserver/apache2/.gitattributes | 2 + tests/testserver/common/.gitattributes | 2 + tests/testserver/common/startup.sh | 4 +- tests/testserver/danted/.gitattributes | 2 + tests/testserver/docker-compose-for-windows.yml | 99 +++++++++++++++++++++++++ tests/testserver/ftp-proxy/.gitattributes | 2 + tests/testserver/squid/.gitattributes | 2 + tests/testserver/vsftpd/.gitattributes | 2 + 8 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 tests/testserver/apache2/.gitattributes create mode 100644 tests/testserver/common/.gitattributes create mode 100644 tests/testserver/danted/.gitattributes create mode 100644 tests/testserver/docker-compose-for-windows.yml create mode 100644 tests/testserver/ftp-proxy/.gitattributes create mode 100644 tests/testserver/squid/.gitattributes create mode 100644 tests/testserver/vsftpd/.gitattributes (limited to 'tests/testserver') diff --git a/tests/testserver/apache2/.gitattributes b/tests/testserver/apache2/.gitattributes new file mode 100644 index 0000000000..67af4c73e8 --- /dev/null +++ b/tests/testserver/apache2/.gitattributes @@ -0,0 +1,2 @@ +* text eol=lf +*.gif -text diff --git a/tests/testserver/common/.gitattributes b/tests/testserver/common/.gitattributes new file mode 100644 index 0000000000..21f6efbe14 --- /dev/null +++ b/tests/testserver/common/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.conf text eol=lf diff --git a/tests/testserver/common/startup.sh b/tests/testserver/common/startup.sh index 84d4003f86..74990a47f6 100755 --- a/tests/testserver/common/startup.sh +++ b/tests/testserver/common/startup.sh @@ -49,7 +49,9 @@ do $RUN_CMD done # start multicast DNS service discovery (mDNS) -sed -i "s,#domain-name=local,domain-name=test-net.qt.local," /etc/avahi/avahi-daemon.conf +sed -i -e "s,#domain-name=local,domain-name=${test_domain:-test-net.qt.local}," \ + -e "s,#publish-aaaa-on-ipv4=yes,publish-aaaa-on-ipv4=no," \ + /etc/avahi/avahi-daemon.conf service dbus restart service avahi-daemon restart diff --git a/tests/testserver/danted/.gitattributes b/tests/testserver/danted/.gitattributes new file mode 100644 index 0000000000..21f6efbe14 --- /dev/null +++ b/tests/testserver/danted/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.conf text eol=lf diff --git a/tests/testserver/docker-compose-for-windows.yml b/tests/testserver/docker-compose-for-windows.yml new file mode 100644 index 0000000000..07da5bcc70 --- /dev/null +++ b/tests/testserver/docker-compose-for-windows.yml @@ -0,0 +1,99 @@ +version: '3.4' + +# The tag of images is used by docker compose file to launch the corresponding +# docker containers. The value of tag comes from the provisioning script +# (coin/provisioning/.../testserver/docker_testserver.sh). The script gets SHA-1 +# of each server context as the tag of docker images. If one of the server +# contexts gets changes, please make sure to update this compose file as well. +# You can run command 'docker images' to list all the tags of test server images. +# For example: +# REPOSITORY TAG +# qt-test-server-apache2 537fe302f61851d1663f41495230d8e3554a4a13 + +services: + apache2: + image: qt-test-server-apache2:537fe302f61851d1663f41495230d8e3554a4a13 + container_name: qt-test-server-apache2 + domainname: ${TEST_DOMAIN} + volumes: + - ./common:/common:ro + - ./apache2:/service:ro + entrypoint: common/startup.sh + command: [common/ssl.sh, service/apache2.sh] + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + squid: + image: qt-test-server-squid:9c32f41b19aca3d778733c4d8fb0ecc5955e893c + container_name: qt-test-server-squid + domainname: ${TEST_DOMAIN} + depends_on: + - apache2 + volumes: + - ./common:/common:ro + - ./squid:/service:ro + entrypoint: common/startup.sh + command: service/squid.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + vsftpd: + image: qt-test-server-vsftpd:f3a9c8d793a77cc007c0e4e481bec01f9e3eeb7e + container_name: qt-test-server-vsftpd + domainname: ${TEST_DOMAIN} + volumes: + - ./common:/common:ro + - ./vsftpd:/service:ro + entrypoint: common/startup.sh + command: service/vsftpd.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + ftp-proxy: + image: qt-test-server-ftp-proxy:d7de8b28392d173db512a558ccc84ead8bece2ae + container_name: qt-test-server-ftp-proxy + domainname: ${TEST_DOMAIN} + depends_on: + - vsftpd + volumes: + - ./common:/common:ro + - ./ftp-proxy:/service:ro + entrypoint: common/startup.sh + command: service/ftp-proxy.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - test_domain=${TEST_DOMAIN} + + danted: + image: qt-test-server-danted:35607f9b790524cf9690c7d12a9a401696b7b6b5 + container_name: qt-test-server-danted + domainname: ${TEST_DOMAIN} + depends_on: + - apache2 + - vsftpd + - ftp-proxy + volumes: + - ./common:/common:ro + - ./danted:/service:ro + entrypoint: common/startup.sh + command: service/danted.sh + network_mode: "host" + extra_hosts: + - "qt-test-server.${TEST_DOMAIN}:${MACHINE_IP}" + environment: + - danted_internal=${MACHINE_IP:-eth0} + - danted_external=${MACHINE_IP:-eth0} + - danted_auth_internal=${MACHINE_IP:-eth0} + - danted_auth_external=${MACHINE_IP:-eth0} + - test_domain=${TEST_DOMAIN} diff --git a/tests/testserver/ftp-proxy/.gitattributes b/tests/testserver/ftp-proxy/.gitattributes new file mode 100644 index 0000000000..21f6efbe14 --- /dev/null +++ b/tests/testserver/ftp-proxy/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.conf text eol=lf diff --git a/tests/testserver/squid/.gitattributes b/tests/testserver/squid/.gitattributes new file mode 100644 index 0000000000..21f6efbe14 --- /dev/null +++ b/tests/testserver/squid/.gitattributes @@ -0,0 +1,2 @@ +*.sh text eol=lf +*.conf text eol=lf diff --git a/tests/testserver/vsftpd/.gitattributes b/tests/testserver/vsftpd/.gitattributes new file mode 100644 index 0000000000..67af4c73e8 --- /dev/null +++ b/tests/testserver/vsftpd/.gitattributes @@ -0,0 +1,2 @@ +* text eol=lf +*.gif -text -- cgit v1.2.3