From 9307fa6f891bf83254e5bb196812a17d5cfb87c2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Jan 2021 02:20:32 +0100 Subject: [PATCH] Run httpbin locally for the tests in the CI builds Run httpbin (either directly or inside a container) and set WX_TEST_WEBREQUEST_URL to point to localhost. Note that it is important _not_ to have a trailing slash in the root URL, otherwise WebRequest::Auth::Digest test would fail. --- build/tools/appveyor-test.bat | 9 +++++++++ build/tools/travis-ci.sh | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/build/tools/appveyor-test.bat b/build/tools/appveyor-test.bat index f0319c16ed..d755030093 100755 --- a/build/tools/appveyor-test.bat +++ b/build/tools/appveyor-test.bat @@ -1,3 +1,12 @@ +echo. +echo --- Running httpbin... +echo. + +pip install httpbin +start /b python -m httpbin.core +set WX_TEST_WEBREQUEST_URL="http://127.0.0.1:5000" +curl http://127.0.0.1:5000/ip + echo. echo --- Running tests. echo. diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 6df3b2d8a3..1c07d12bdf 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -12,6 +12,16 @@ wxBUILD_ARGS="-j$wxPROC_COUNT" # messages from WebKit tests that we're not interested in. export NO_AT_BRIDGE=1 +launch_httpbin() { + echo 'travis_fold:start:httpbin' + echo 'Running httpbin container...' + docker pull kennethreitz/httpbin + docker run -d -p 80:80 kennethreitz/httpbin + WX_TEST_WEBREQUEST_URL="http://localhost" + export WX_TEST_WEBREQUEST_URL + echo 'travis_fold:end:httpbin' +} + case $wxTOOLSET in cmake) if [ -z $wxCMAKE_TESTS ]; then wxCMAKE_TESTS=CONSOLE_ONLY; fi @@ -42,6 +52,8 @@ case $wxTOOLSET in echo 'travis_fold:end:install' if [ "$wxCMAKE_TESTS" != "OFF" ]; then + launch_httpbin + echo 'travis_fold:start:testing' echo 'Testing...' ctest -V -C Debug -E "test_drawing" --output-on-failure --interactive-debug-mode 0 . @@ -124,6 +136,8 @@ case $wxTOOLSET in exit 0 fi + launch_httpbin + echo 'travis_fold:start:testing' echo 'Testing...' pushd tests