From a3cd1f249501d0d44f8a8f0811e32101c9069617 Mon Sep 17 00:00:00 2001 From: wi1dcard Date: Sun, 17 Mar 2024 10:50:43 +0800 Subject: [PATCH] Run e2e test with fingerproxy, not echo server. --- .github/workflows/ci.yaml | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 08a6a30..12d6852 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -53,8 +53,8 @@ jobs: name: fingerproxy_linux_amd64_${{ steps.short-sha.outputs.value }} path: bin/fingerproxy_linux_amd64 - build-echoserver: - name: Build echo server + build-test-deps: + name: Build test deps runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -67,24 +67,26 @@ jobs: go version go get go build -tags debug ./example/echo-server + go build -tags debug -o fingerproxy ./cmd ./testdata/gencert.sh - uses: actions/upload-artifact@v4 with: - name: echoserver-ci-only + name: ci-test-deps path: | echo-server + fingerproxy tls.crt tls.key e2e-test: name: E2E test runs-on: ubuntu-latest - needs: build-echoserver + needs: build-test-deps steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - name: echoserver-ci-only + name: ci-test-deps - name: Setup curl run: | wget https://github.com/stunnel/static-curl/releases/download/8.6.0-1/curl-linux-x86_64-8.6.0.tar.xz @@ -92,22 +94,25 @@ jobs: ./curl --version - name: Test run: | - chmod +x ./echo-server - ./echo-server -verbose & + chmod +x ./fingerproxy + ./fingerproxy -verbose \ + -listen-addr localhost:8443 \ + -forward-url https://httpbin.org & + sleep 1 - ./curl -v --fail --insecure -o o.json https://localhost:8443/json + ./curl -v --fail --insecure -o o.json "https://localhost:8443/anything?show_env=1" cat o.json | jq - test $(jq -r '.http2' o.json) = "3:100;4:10485760;2:0|1048510465|0|m,s,a,p" - test $(jq -r '.ja3' o.json) = "0149f47eabf9a20d0893e2a44e5a6323" - test $(jq -r '.ja4' o.json) = "t13d3112h2_e8f1e7e78f70_6bebaf5329ac" - test $(jq -r '."user-agent"' o.json) = "curl/8.6.0" + test $(jq -r '.headers."X-Http2-Fingerprint"' o.json) = "3:100;4:10485760;2:0|1048510465|0|m,s,a,p" + test $(jq -r '.headers."X-Ja3-Fingerprint"' o.json) = "0149f47eabf9a20d0893e2a44e5a6323" + test $(jq -r '.headers."X-Ja4-Fingerprint"' o.json) = "t13d3112h2_e8f1e7e78f70_6bebaf5329ac" + test $(jq -r '.headers."User-Agent"' o.json) = "curl/8.6.0" load-test: name: Load test runs-on: ubuntu-latest - needs: build-echoserver + needs: build-test-deps strategy: matrix: number_of_requests: [1000, 10000, 50000] @@ -115,7 +120,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - name: echoserver-ci-only + name: ci-test-deps - name: Setup ab run: | sudo apt-get install -y apache2-utils @@ -135,12 +140,12 @@ jobs: benchmark: name: Benchmark runs-on: ubuntu-latest - needs: build-echoserver + needs: build-test-deps steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - name: echoserver-ci-only + name: ci-test-deps - name: Setup wrk run: | sudo apt-get install -y wrk