From 145fc8b0215f5149ef4c1de6233951946294a9f3 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sun, 6 Jul 2025 22:00:41 -0400 Subject: [PATCH] Proxy test (#2172) * Add proxy test on CI * Add Brotli and Zstd dev packages to proxy test workflow * Fix Docker Compose command for GitHub Actions compatibility * Add proxy readiness check and netcat dependency * Use netcat-openbsd instead of virtual netcat package * Add proxy startup delay and debug logging --- .github/workflows/test_proxy.yaml | 20 ++++++++++++++++++++ .gitignore | 2 +- test/Makefile | 12 ++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test_proxy.yaml diff --git a/.github/workflows/test_proxy.yaml b/.github/workflows/test_proxy.yaml new file mode 100644 index 0000000..571dc96 --- /dev/null +++ b/.github/workflows/test_proxy.yaml @@ -0,0 +1,20 @@ +name: Proxy Test + +on: [push, pull_request] + +jobs: + test-proxy: + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential libssl-dev zlib1g-dev libcurl4-openssl-dev libbrotli-dev libzstd-dev netcat-openbsd + + - name: Run proxy tests + run: | + cd test && make proxy \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1ae8acf..a4cacc7 100644 --- a/.gitignore +++ b/.gitignore @@ -42,4 +42,4 @@ ipch *.pyc .* !/.gitattributes -!/.travis.yml +!/.github diff --git a/test/Makefile b/test/Makefile index 56cfbc1..900cb56 100644 --- a/test/Makefile +++ b/test/Makefile @@ -53,12 +53,20 @@ all : test test_split proxy : test_proxy @echo "Starting proxy server..." cd proxy && \ - docker-compose up -d + docker compose up -d + @echo "Waiting for proxy to be ready..." + @until nc -z localhost 3128 && nc -z localhost 3129; do sleep 1; done + @echo "Proxy servers are ready, waiting additional 5 seconds for full startup..." + @sleep 5 + @echo "Checking proxy server status..." + @cd proxy && docker compose ps + @echo "Checking proxy server logs..." + @cd proxy && docker compose logs --tail=20 @echo "Running proxy tests..." ./test_proxy; \ exit_code=$$?; \ echo "Stopping proxy server..."; \ - docker-compose down; \ + cd proxy && docker compose down; \ exit $$exit_code test : test.cc include_httplib.cc ../httplib.h Makefile cert.pem