From 8b5bd53bf3a74a966bf3c28435b9ed9a450c53f4 Mon Sep 17 00:00:00 2001 From: cytopia Date: Sun, 4 Mar 2018 12:01:53 +0100 Subject: [PATCH] Ensure not to use taken ports on travis --- .travis.yml | 15 +++++++++++++++ tests/base/04-test-run_nginx.sh | 2 +- tests/prod/05-test-mount-custom_ini.sh | 9 ++++++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index dad2347..7c880a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,21 @@ install: - max=100; i=0; while [ $i -lt $max ]; do if sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce; then break; else i=$((i+1)); fi done - docker version + # Disable services enabled by default + # http://docs.travis-ci.com/user/database-setup/#MySQL + - sudo /etc/init.d/mysql stop || true + - sudo /etc/init.d/postgresql stop || true + - sudo /etc/init.d/memcached stop || true + - sudo /etc/init.d/redis stop || true + - sudo /etc/init.d/mongodb stop || true + + - sudo service mysql stop || true + - sudo service postgresql stop || true + - sudo service memcached stop || true + - sudo service redis stop || true + - sudo service mongodb stop || true + - netstat -tulpn + ### ### Check generation changes, build and test diff --git a/tests/base/04-test-run_nginx.sh b/tests/base/04-test-run_nginx.sh index 843e934..5dbd346 100755 --- a/tests/base/04-test-run_nginx.sh +++ b/tests/base/04-test-run_nginx.sh @@ -22,7 +22,7 @@ FLAVOUR="${3}" ### ### Test Nginx with PHP-FPM ### -WWW_PORT="12345" +WWW_PORT="23254" DOC_ROOT_HOST="$( mktemp -d )" DOC_ROOT_CONT="/var/www/default" diff --git a/tests/prod/05-test-mount-custom_ini.sh b/tests/prod/05-test-mount-custom_ini.sh index 881684b..516c0c4 100755 --- a/tests/prod/05-test-mount-custom_ini.sh +++ b/tests/prod/05-test-mount-custom_ini.sh @@ -22,7 +22,7 @@ FLAVOUR="${3}" ### ### Test Nginx with PHP-FPM ### -WWW_PORT="12345" +WWW_PORT="23254" DOC_ROOT_HOST="$( mktemp -d )" DOC_ROOT_CONT="/var/www/default" @@ -65,6 +65,9 @@ name="$( docker_name "${did}" )" # Start Nginx ndid="$( docker_run "${CONTAINER}" "-v ${DOC_ROOT_HOST}:${DOC_ROOT_CONT} -v ${CONFIG_HOST}:${CONFIG_CONT} -p ${WWW_PORT}:80 --link ${name}" )" +# Wait for both containers to be up and running +run "sleep 10" + # Check entrypoint if ! run "docker logs ${did} | grep 'post.ini'"; then docker_logs "${ndid}" || true @@ -79,7 +82,7 @@ if ! run "docker logs ${did} | grep 'post.ini'"; then fi # Check PHP connectivity -if ! run "curl -q 127.0.0.1:${WWW_PORT}/index.php >/dev/null 2>&1"; then +if ! run "curl -q localhost:${WWW_PORT}/index.php >/dev/null 2>&1"; then docker_logs "${ndid}" || true docker_logs "${did}" || true docker_stop "${ndid}" || true @@ -106,7 +109,7 @@ if ! docker_exec "${did}" "php -r \"echo ini_get('post_max_size');\" | grep '17M fi # Check modified php.ini -if ! run "curl -q 127.0.0.1:${WWW_PORT}/index.php 2>/dev/null | grep post_max_size | grep '17M'"; then +if ! run "curl -q localhost:${WWW_PORT}/index.php 2>/dev/null | grep post_max_size | grep '17M'"; then docker_exec "${did}" "php -r \"echo ini_get('post_max_size');\"" docker_logs "${ndid}" || true docker_logs "${did}" || true