From 498a504e20440820630c26d4ba2e1dab683a04b0 Mon Sep 17 00:00:00 2001 From: Yang Xiufeng Date: Mon, 21 Oct 2024 08:59:00 +0800 Subject: [PATCH] test forwards with round-robin nginx. --- .../actions/setup_databend_cluster/action.yml | 2 +- .github/workflows/test_cluster.yml | 16 +++++++++++++- scripts/ci/{nginx.conf => nginx_hash.conf} | 0 scripts/ci/nginx_rr.conf | 22 +++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) rename scripts/ci/{nginx.conf => nginx_hash.conf} (100%) create mode 100644 scripts/ci/nginx_rr.conf diff --git a/.github/actions/setup_databend_cluster/action.yml b/.github/actions/setup_databend_cluster/action.yml index 941d1f2e..fef70d37 100644 --- a/.github/actions/setup_databend_cluster/action.yml +++ b/.github/actions/setup_databend_cluster/action.yml @@ -34,7 +34,7 @@ runs: shell: bash run: | docker run -d --network host --name nginx-lb \ - -v ${{ github.workspace }}/scripts/ci/nginx.conf:/etc/nginx/nginx.conf:ro \ + -v ${{ github.workspace }}/scripts/ci/nginx_rr.conf:/etc/nginx/nginx.conf:ro \ nginx - name: Download binary and extract into target directory diff --git a/.github/workflows/test_cluster.yml b/.github/workflows/test_cluster.yml index e79fb51e..62abf59c 100644 --- a/.github/workflows/test_cluster.yml +++ b/.github/workflows/test_cluster.yml @@ -31,7 +31,7 @@ jobs: - uses: ./.github/actions/setup_databend_cluster timeout-minutes: 15 with: - version: '1.2.629-nightly' + version: '1.2.647-nightly' target: 'x86_64-unknown-linux-gnu' - name: Test with conn to node 1 @@ -39,6 +39,20 @@ jobs: env: MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + - name: View Nginx logs + run: docker logs nginx-lb + + - name: check nginx + run: | + curl -u 'databend:databend' -X POST "http://localhost:8010/v1/query" \ + -H 'Content-Type: application/json' \ + -d '{"sql": "select 1", "pagination": { "wait_time_secs": 5 }}' || true + env: + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + + - name: View Nginx logs + run: docker logs nginx-lb + - name: Test with conn to nginx run: mvn test -DexcludedGroups=FLAKY env: diff --git a/scripts/ci/nginx.conf b/scripts/ci/nginx_hash.conf similarity index 100% rename from scripts/ci/nginx.conf rename to scripts/ci/nginx_hash.conf diff --git a/scripts/ci/nginx_rr.conf b/scripts/ci/nginx_rr.conf new file mode 100644 index 00000000..93c0202d --- /dev/null +++ b/scripts/ci/nginx_rr.conf @@ -0,0 +1,22 @@ +events { + worker_connections 1024; +} + +http { + upstream backend { + server 127.0.0.1:8000; + server 127.0.0.1:8002; + server 127.0.0.1:8003; + } + + server { + listen 8010; + + location / { + proxy_pass http://backend; + proxy_set_header X-Databend-Relative-Path $http_x_databend_relative_path; + proxy_set_header X-Databend-Stage-Name $http_x_databend_stage_name; + proxy_set_header X-Databend-Sticky-Node $http_x_databend_sticky_node; + } + } +}