Skip to content

Commit 145fc8b

Browse files
authored
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
1 parent af73377 commit 145fc8b

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

.github/workflows/test_proxy.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Proxy Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-proxy:
7+
runs-on: ubuntu-latest
8+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: Install dependencies
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libcurl4-openssl-dev libbrotli-dev libzstd-dev netcat-openbsd
17+
18+
- name: Run proxy tests
19+
run: |
20+
cd test && make proxy

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ ipch
4242
*.pyc
4343
.*
4444
!/.gitattributes
45-
!/.travis.yml
45+
!/.github

test/Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,20 @@ all : test test_split
5353
proxy : test_proxy
5454
@echo "Starting proxy server..."
5555
cd proxy && \
56-
docker-compose up -d
56+
docker compose up -d
57+
@echo "Waiting for proxy to be ready..."
58+
@until nc -z localhost 3128 && nc -z localhost 3129; do sleep 1; done
59+
@echo "Proxy servers are ready, waiting additional 5 seconds for full startup..."
60+
@sleep 5
61+
@echo "Checking proxy server status..."
62+
@cd proxy && docker compose ps
63+
@echo "Checking proxy server logs..."
64+
@cd proxy && docker compose logs --tail=20
5765
@echo "Running proxy tests..."
5866
./test_proxy; \
5967
exit_code=$$?; \
6068
echo "Stopping proxy server..."; \
61-
docker-compose down; \
69+
cd proxy && docker compose down; \
6270
exit $$exit_code
6371

6472
test : test.cc include_httplib.cc ../httplib.h Makefile cert.pem

0 commit comments

Comments
 (0)