From a28a24e2f25db25285520af84533c978f7a0c604 Mon Sep 17 00:00:00 2001 From: Matteo Scaramuccia Date: Wed, 10 Jun 2020 22:44:07 +0200 Subject: [PATCH] MDL-66322 travis: Configure a local copy of 'exttests' --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a20352ac23b..8ce5c8e8b85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ dist: xenial services: - mysql + - docker php: # We only run the highest and lowest supported versions to reduce the load on travis-ci.org. @@ -61,8 +62,9 @@ cache: - $HOME/.npm before_install: + - docker run -d -p 127.0.0.1:8080:80 --name exttests moodlehq/moodle-exttests # Avoid IPv6 default binding as service (causes redis not to start). - sudo service redis-server start --bind 127.0.0.1 + - sudo service redis-server start --bind 127.0.0.1 install: - > @@ -169,6 +171,10 @@ before_script: -e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \ -e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \ config.php ; + # Enable test external resources + sed -i \ + -e "/require_once/i \\define('TEST_EXTERNAL_FILES_HTTP_URL', 'http://127.0.0.1:8080');" \ + config.php ; # Redis cache store tests sed -i \ -e "/require_once/i \\define('TEST_CACHESTORE_REDIS_TESTSERVERS', '127.0.0.1');" \ @@ -248,6 +254,8 @@ script: if [ "$TASK" = 'PHPUNIT' ]; then vendor/bin/phpunit --fail-on-risky --disallow-test-output --verbose; + EXTTESTS_HITS=$(docker logs exttests 2>&1 | grep -Fv -e 'AH00558' -e '[pid 1]' | wc -l) + echo -e "\nTest local resources number of hits: ${EXTTESTS_HITS}.\n" fi - >