Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try go-httpbin #23398

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,9 @@ jobs:

# Explanation for installing some less obvious packages:
# - coreutils contains nproc used in proc_count.sh called below.
# - Python can't be installed using the action as usual because
# it installs an ABI-incompatible version, see (wrongly, IMO)
# closed https://github.com/actions/setup-python/issues/370
# - And python3-cffi can't be installed by pip because it can't
# be built from source with gcc 4.8 any longer (its build
# script uses -Wdate-time option unknown to this compiler).
# - xvfb is used for running the GUI tests.
apt-get update -qq
apt-get install -qq coreutils ${compiler-g++} git make pkg-config python3 python3-cffi python3-pip sudo xvfb
apt-get install -qq coreutils ${compiler-g++} git make pkg-config sudo xvfb
;;

'')
Expand Down Expand Up @@ -324,11 +318,17 @@ jobs:
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_tests }}

- name: Setup Python
if: matrix.container == ''
uses: actions/setup-python@v5
- name: Setup Go
if: matrix.container != 'ubuntu:18.04'
uses: actions/setup-go@v5
with:
go-version: '1'

- name: Setup Go Ubuntu 18.04
if: matrix.container == 'ubuntu:18.04'
uses: actions/setup-go@v4
with:
python-version: '3.10'
go-version: '1'

- name: Testing
working-directory: tests
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,11 @@ jobs:
cmake --build . --target install
fi

- name: Setup Python
uses: actions/setup-python@v5
- name: Setup Go
if: matrix.cmake_tests != 'OFF'
uses: actions/setup-go@v5
with:
python-version: '3.10'
go-version: '1'

- name: Testing
if: matrix.cmake_tests != 'OFF'
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/ci_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,11 @@ jobs:
make -C tests $wxBUILD_ARGS failtest
make -k -C tests $wxBUILD_ARGS "CXXFLAGS=$wxMAKEFILE_CXXFLAGS" "LDFLAGS=$wxMAKEFILE_LDFLAGS"

- name: Setup Python
# actions/setup-python broken on self-hosted https://github.com/actions/setup-python/issues/108
if: matrix.runner != 'self-hosted'
uses: actions/setup-python@v5
- name: Setup Go
if: matrix.skip_testing != true
uses: actions/setup-go@v5
with:
python-version: '3.10'
go-version: '1'

- name: Testing
if: matrix.skip_testing != true
Expand Down
20 changes: 14 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ skip_commits:
- build/tools/httpbin.sh

environment:
GOVERSION: "1.22.1"
GOPATH: c:\gopath
matrix:
- TOOLSET: msbuild
CONFIGURATION: DLL Release
Expand Down Expand Up @@ -83,15 +85,21 @@ before_build:
build_script: c:\projects\wxwidgets\build\tools\appveyor.bat

before_test:
- cmd: |
echo Getting and launching httpbin.
rmdir %GOROOT% /s /q
mkdir %GOROOT%
appveyor DownloadFile https://go.dev/dl/go%GOVERSION%.windows-amd64.msi
msiexec /i go%GOVERSION%.windows-amd64.msi INSTALLDIR="%GOROOT%" /q
go version
go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@v2
set PATH=%PATH%;%GOPATH%\bin
- ps: |
Write-Output "Getting and launching httpbin."
$env:PATH = "C:\Python38;C:\Python38\Scripts;" + $env:PATH
pip.exe --disable-pip-version-check install Flask==2.0.3 Werkzeug==2.0.3 httpbin
Start-Job -Name wx_httpbin { python.exe -m httpbin.core 2>&1 > c:\projects\wxwidgets\httpbin.log }
Start-Job -Name wx_httpbin { go-httpbin -host 127.0.0.1 -port 8081 2>&1 > c:\projects\wxwidgets\httpbin.log }
Start-Sleep -Seconds 5
curl.exe --silent --show-error http://127.0.0.1:5000/ip > $null
curl.exe --silent --show-error http://127.0.0.1:8081/ip > $null
if ($lastExitCode -eq "0") {
$env:WX_TEST_WEBREQUEST_URL="http://127.0.0.1:5000"
$env:WX_TEST_WEBREQUEST_URL="http://127.0.0.1:8081"
}
else {
Write-Error "Disabling wxWebRequest tests as launching httpbin failed, log follows:"
Expand Down
14 changes: 5 additions & 9 deletions build/tools/httpbin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ httpbin_launch() {
WX_TEST_WEBREQUEST_URL=0
export WX_TEST_WEBREQUEST_URL

echo 'Launching httpbin...'

# Installing Flask 2.1.0 and its dependency Werkzeug 2.1.0 results
# in failures when trying to run httpbin, so stick to an older but
# working version.
pip_explicit_deps='Flask==2.0.3 Werkzeug==2.0.3'
go version
go install github.com/mccutchen/go-httpbin/v2/cmd/go-httpbin@v2

python3 -m pip install $pip_explicit_deps 'httpbin==0.7.0' --user
python3 -m httpbin.core --port 50500 2>&1 >httpbin.log &
WX_TEST_WEBREQUEST_URL="http://localhost:50500"
echo 'Launching httpbin...'
go-httpbin -host 127.0.0.1 -port 8081 2>&1 >httpbin.log &
WX_TEST_WEBREQUEST_URL="http://127.0.0.1:8081"
}

httpbin_show_log() {
Expand Down
3 changes: 2 additions & 1 deletion tests/net/webrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ TEST_CASE_METHOD(RequestFixture,
pos += strlen(expectedKey);

// There may, or not, be a space after it.
while ( wxIsspace(response[pos]) )
// And the value may be returned in an array.
while ( wxIsspace(response[pos]) || response[pos] == '[' )
MaartenBent marked this conversation as resolved.
Show resolved Hide resolved
pos++;

const char* expectedValue = "\"3.14159265358979323\"";
Expand Down
Loading