From 00aee0087e073bb96ba4d7cd122f1d719be8b3f1 Mon Sep 17 00:00:00 2001 From: kayx23 Date: Tue, 27 Oct 2026 14:18:08 +0800 Subject: [PATCH] ci: stabilize historical branch environments --- .github/workflows/build.yml | 2 +- .github/workflows/check-changelog.yml | 2 +- .github/workflows/cli.yml | 2 +- .github/workflows/close-unresponded.yml | 2 +- .github/workflows/code-lint.yml | 4 +- .github/workflows/doc-lint.yml | 4 +- .github/workflows/docker-standalone.yml | 2 +- .github/workflows/kubernetes-ci.yml | 2 +- .github/workflows/license-checker.yml | 2 +- .github/workflows/link-check.yml | 2 +- .github/workflows/lint.yml | 4 +- .../workflows/push-dev-image-on-commit.yml | 2 +- .github/workflows/redhat-ci.yaml | 2 +- .github/workflows/semantic.yml | 2 +- .github/workflows/source-install.yml | 2 +- .github/workflows/stale.yml | 2 +- .github/workflows/tars-ci.yml | 2 +- .github/workflows/update-labels.yml | 6 +-- ci/common.sh | 5 +- docker/debian-dev/Dockerfile | 4 +- t/cli/common.sh | 24 +++++++++ t/cli/test_dns.sh | 12 ++++- t/cli/test_etcd_sync_event_handle.sh | 13 ++++- t/cli/test_prometheus_stream.sh | 50 ++++++++++++++----- t/lib/server.lua | 14 ++++++ t/plugin/openid-connect.t | 28 +++++------ t/xrpc/prometheus.t | 9 ++++ t/xrpc/redis.t | 7 ++- 28 files changed, 155 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df8d267fa9cb..e1a177617b0a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: platform: - - ubuntu-latest + - ubuntu-24.04 os_name: - linux_openresty test_dir: diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml index 7ed3c143b82c..17db12d88d57 100644 --- a/.github/workflows/check-changelog.yml +++ b/.github/workflows/check-changelog.yml @@ -12,7 +12,7 @@ on: jobs: check-changelog: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index c6a12ea2dee1..0aa140fdbef3 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: platform: - - ubuntu-latest + - ubuntu-24.04 job_name: - linux_apisix_current_luarocks - linux_apisix_current_luarocks_in_customed_nginx diff --git a/.github/workflows/close-unresponded.yml b/.github/workflows/close-unresponded.yml index c4e01ea7c00a..d9a9ec7dcfa6 100644 --- a/.github/workflows/close-unresponded.yml +++ b/.github/workflows/close-unresponded.yml @@ -13,7 +13,7 @@ jobs: permissions: issues: write # for actions/stale to close stale issues name: Prune Unresponded - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 10 steps: diff --git a/.github/workflows/code-lint.yml b/.github/workflows/code-lint.yml index 846ea68994de..e852a71f048d 100644 --- a/.github/workflows/code-lint.yml +++ b/.github/workflows/code-lint.yml @@ -12,7 +12,7 @@ permissions: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -33,7 +33,7 @@ jobs: make lint sc-lint: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: - name: Checkout code diff --git a/.github/workflows/doc-lint.yml b/.github/workflows/doc-lint.yml index cab05f92c421..f03b64559a8d 100644 --- a/.github/workflows/doc-lint.yml +++ b/.github/workflows/doc-lint.yml @@ -19,7 +19,7 @@ permissions: jobs: markdownlint: name: 🍇 Markdown - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 1 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -46,7 +46,7 @@ jobs: Chinse-Copywriting-lint: name: Chinese Copywriting - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 1 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.github/workflows/docker-standalone.yml b/.github/workflows/docker-standalone.yml index 9201c77a8b33..675618ca3317 100644 --- a/.github/workflows/docker-standalone.yml +++ b/.github/workflows/docker-standalone.yml @@ -27,7 +27,7 @@ permissions: jobs: docker-test: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 30 steps: diff --git a/.github/workflows/kubernetes-ci.yml b/.github/workflows/kubernetes-ci.yml index 5487df3a6340..99194f8c4295 100644 --- a/.github/workflows/kubernetes-ci.yml +++ b/.github/workflows/kubernetes-ci.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: platform: - - ubuntu-latest + - ubuntu-24.04 os_name: - linux_openresty diff --git a/.github/workflows/license-checker.yml b/.github/workflows/license-checker.yml index 26df6cbf58ce..c22f35866f95 100644 --- a/.github/workflows/license-checker.yml +++ b/.github/workflows/license-checker.yml @@ -26,7 +26,7 @@ on: jobs: check-license: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 3 steps: diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml index a0f128e7762e..3f32892dd103 100644 --- a/.github/workflows/link-check.yml +++ b/.github/workflows/link-check.yml @@ -29,7 +29,7 @@ concurrency: jobs: check-links: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7eb237c8c876..1610a616aa17 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,7 @@ permissions: jobs: misc: name: misc checker - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Check out code. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -25,7 +25,7 @@ jobs: bash ./utils/check-plugins-code.sh ci-eclint: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 5 steps: diff --git a/.github/workflows/push-dev-image-on-commit.yml b/.github/workflows/push-dev-image-on-commit.yml index 31fe6b89e818..9518e3534c40 100644 --- a/.github/workflows/push-dev-image-on-commit.yml +++ b/.github/workflows/push-dev-image-on-commit.yml @@ -93,7 +93,7 @@ jobs: merge-tags: needs: build-test-push if: github.ref == 'refs/heads/master' - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Login to Docker Hub uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0 diff --git a/.github/workflows/redhat-ci.yaml b/.github/workflows/redhat-ci.yaml index 17742dbefab3..c538a193cde2 100644 --- a/.github/workflows/redhat-ci.yaml +++ b/.github/workflows/redhat-ci.yaml @@ -18,7 +18,7 @@ permissions: jobs: test_apisix: name: run ci on redhat ubi - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 90 strategy: fail-fast: false diff --git a/.github/workflows/semantic.yml b/.github/workflows/semantic.yml index 88cc8b1d019d..e0aa8b7617fd 100644 --- a/.github/workflows/semantic.yml +++ b/.github/workflows/semantic.yml @@ -10,7 +10,7 @@ on: jobs: main: name: Validate PR title - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Check out repository code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.github/workflows/source-install.yml b/.github/workflows/source-install.yml index dcedbed471e2..900d6458d145 100644 --- a/.github/workflows/source-install.yml +++ b/.github/workflows/source-install.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: platform: - - ubuntu-latest + - ubuntu-24.04 os_platform: - ubuntu - redhat diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index f7e5948063ec..4d2e1405df8c 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -14,7 +14,7 @@ jobs: issues: write # for actions/stale to close stale issues pull-requests: write # for actions/stale to close stale PRs name: Prune Stale - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 10 steps: diff --git a/.github/workflows/tars-ci.yml b/.github/workflows/tars-ci.yml index 3eb4c3f2da89..5acec6088e95 100644 --- a/.github/workflows/tars-ci.yml +++ b/.github/workflows/tars-ci.yml @@ -25,7 +25,7 @@ jobs: fail-fast: false matrix: platform: - - ubuntu-latest + - ubuntu-24.04 os_name: - linux_openresty diff --git a/.github/workflows/update-labels.yml b/.github/workflows/update-labels.yml index 1c46a99525f6..03df34729efc 100644 --- a/.github/workflows/update-labels.yml +++ b/.github/workflows/update-labels.yml @@ -12,7 +12,7 @@ on: jobs: issue_commented: if: github.event.issue && !github.event.issue.pull_request && github.event.comment.user.login == github.event.issue.user.login && contains(github.event.issue.labels.*.name, 'wait for update') && !contains(github.event.issue.labels.*.name, 'user responded') - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: update labels when user responds uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 @@ -33,7 +33,7 @@ jobs: pr_commented: if: github.event.issue && github.event.issue.pull_request && github.event.comment.user.login == github.event.issue.user.login && (contains(github.event.issue.labels.*.name, 'wait for update') || contains(github.event.issue.labels.*.name, 'discuss') || contains(github.event.issue.labels.*.name, 'need test cases')) && !contains(github.event.issue.labels.*.name, 'user responded') - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: update label when user responds uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 @@ -48,7 +48,7 @@ jobs: pr_review_commented: if: github.event.pull_request && github.event.comment.user.login == github.event.pull_request.user.login && (contains(github.event.pull_request.labels.*.name, 'wait for update') || contains(github.event.pull_request.labels.*.name, 'discuss') || contains(github.event.issue.labels.*.name, 'need test cases')) && !contains(github.event.pull_request.labels.*.name, 'user responded') - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: update label when user responds uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 diff --git a/ci/common.sh b/ci/common.sh index b99819b5e43c..8d13ce340314 100644 --- a/ci/common.sh +++ b/ci/common.sh @@ -108,7 +108,10 @@ install_nodejs () { export PNPM_HOME="/pnpm" export PATH="$PNPM_HOME:$PATH" corepack enable pnpm - pnpm setup + # Pin the pnpm used outside t/, which has its own packageManager pin. + # pnpm 12 rejects setup under sudo, while these maintenance branches run + # this installer through sudo in CI. Keep the last version known to work. + corepack prepare pnpm@11.25.0 --activate } install_brotli () { diff --git a/docker/debian-dev/Dockerfile b/docker/debian-dev/Dockerfile index ff906d551562..9ec89424ae81 100644 --- a/docker/debian-dev/Dockerfile +++ b/docker/debian-dev/Dockerfile @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -FROM debian:bullseye-slim AS build +FROM debian/eol:bullseye AS build ARG ENABLE_PROXY=false ARG CODE_PATH @@ -39,7 +39,7 @@ RUN set -x \ && cp -r deps ${ENV_INST_LUADIR} \ && make install -FROM debian:bullseye-slim +FROM debian/eol:bullseye ARG ENTRYPOINT_PATH=./docker-entrypoint.sh ARG INSTALL_BROTLI=./install-brotli.sh diff --git a/t/cli/common.sh b/t/cli/common.sh index a4e2dea540a1..107d41a1a2e0 100644 --- a/t/cli/common.sh +++ b/t/cli/common.sh @@ -39,5 +39,29 @@ exit_if_not_customed_nginx() { openresty -V 2>&1 | grep apisix-nginx-module || exit 0 } +# wait_for_tcp [timeout_secs] +# Poll until the port accepts TCP; default timeout 10s. Bash-only (/dev/tcp, local). +wait_for_tcp() { + if [ -z "${BASH_VERSION:-}" ]; then + echo "wait_for_tcp: requires bash" >&2 + return 2 + fi + local host="$1" + local port="$2" + local timeout="${3:-10}" + local deadline=$(( $(date +%s) + timeout )) + { set +x; } 2>/dev/null + while [ "$(date +%s)" -lt "$deadline" ]; do + if (exec 3<>/dev/tcp/"$host"/"$port") 2>/dev/null; then + set -x + return 0 + fi + sleep 0.1 + done + set -x + echo "wait_for_tcp: ${host}:${port} not accepting connections after ${timeout}s" >&2 + return 1 +} + rm logs/error.log || true # clear previous error log unset APISIX_PROFILE diff --git a/t/cli/test_dns.sh b/t/cli/test_dns.sh index f0e19a837597..e60b5e69441f 100755 --- a/t/cli/test_dns.sh +++ b/t/cli/test_dns.sh @@ -143,7 +143,8 @@ nginx_config: " > conf/config.yaml make run -sleep 0.5 +wait_for_tcp 127.0.0.1 9180 +wait_for_tcp 127.0.0.1 9100 admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g') curl -v -k -i -m 20 -o /dev/null -s -X PUT http://127.0.0.1:9180/apisix/admin/stream_routes/1 \ -H "X-API-KEY: $admin_key" \ @@ -158,7 +159,14 @@ curl -v -k -i -m 20 -o /dev/null -s -X PUT http://127.0.0.1:9180/apisix/admin/st } }' -curl http://127.0.0.1:9100 || true +# Fire probes over a 10s window to cover etcd->stream-worker propagation. +deadline=$(( $(date +%s) + 10 )) +{ set +x; } 2>/dev/null +while [ "$(date +%s)" -lt "$deadline" ]; do + curl -s --connect-timeout 1 --max-time 2 http://127.0.0.1:9100 >/dev/null 2>&1 || true + sleep 0.2 +done +set -x make stop sleep 0.1 # wait for logs output diff --git a/t/cli/test_etcd_sync_event_handle.sh b/t/cli/test_etcd_sync_event_handle.sh index a348b52b7acd..2e608f4b0780 100755 --- a/t/cli/test_etcd_sync_event_handle.sh +++ b/t/cli/test_etcd_sync_event_handle.sh @@ -89,7 +89,18 @@ etcdctl --endpoints=127.0.0.1:2379 --user=root:apache-api6-sync put /apisix/rout etcdctl --endpoints=127.0.0.1:2379 --user=root:apache-api6-sync auth disable etcdctl --endpoints=127.0.0.1:2379 user delete root etcdctl --endpoints=127.0.0.1:2379 role delete root -sleep 5 # wait resync by watch +# Wait for resync by watch. The fixed `sleep 5` was racy on slow runners — the etcd +# auth-toggle + watch-reconnect + bulk-event-apply can take longer, so poll route /1 +# until the fault-injection plugin is applied (status 204). +deadline=$(( $(date +%s) + 30 )) +{ set +x; } 2>/dev/null +while [ "$(date +%s)" -lt "$deadline" ]; do + if [ "$(curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:9080/1)" = "204" ]; then + break + fi + sleep 0.5 +done +set -x # Test request # All but the intentionally incoming misconfigurations should be applied, diff --git a/t/cli/test_prometheus_stream.sh b/t/cli/test_prometheus_stream.sh index d9cca32644eb..72fb96759b72 100755 --- a/t/cli/test_prometheus_stream.sh +++ b/t/cli/test_prometheus_stream.sh @@ -36,7 +36,8 @@ plugin_attr: " > conf/config.yaml make run -sleep 0.5 +wait_for_tcp 127.0.0.1 9180 +wait_for_tcp 127.0.0.1 9100 admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g') curl -v -k -i -m 20 -o /dev/null -s -X PUT http://127.0.0.1:9180/apisix/admin/stream_routes/1 \ @@ -55,11 +56,22 @@ curl -v -k -i -m 20 -o /dev/null -s -X PUT http://127.0.0.1:9180/apisix/admin/st } }' -curl http://127.0.0.1:9100 || true -sleep 1 # wait for sync - -out="$(curl http://127.0.0.1:9091/apisix/prometheus/metrics)" -if ! echo "$out" | grep "apisix_stream_connection_total{route=\"1\"} 1" > /dev/null; then +# Retry trigger + read: route-propagation and exporter-cache populate are both async. +# Counter can exceed 1 across retries, so match any positive integer. +ok=0 +deadline=$(( $(date +%s) + 20 )) +{ set +x; } 2>/dev/null +while [ "$(date +%s)" -lt "$deadline" ]; do + curl -s --connect-timeout 1 --max-time 2 http://127.0.0.1:9100 >/dev/null 2>&1 || true + if curl -s --connect-timeout 1 --max-time 2 http://127.0.0.1:9091/apisix/prometheus/metrics \ + | grep -qE 'apisix_stream_connection_total\{route="1"\} [1-9][0-9]*'; then + ok=1 + break + fi + sleep 0.5 +done +set -x +if [ "$ok" -ne 1 ]; then echo "failed: prometheus can't work in stream subsystem" exit 1 fi @@ -83,13 +95,25 @@ plugin_attr: " > conf/config.yaml make run -sleep 0.5 - -curl http://127.0.0.1:9100 || true -sleep 1 # wait for sync - -out="$(curl http://127.0.0.1:9091/apisix/prometheus/metrics)" -if ! echo "$out" | grep "apisix_stream_connection_total{route=\"1\"} 1" > /dev/null; then +wait_for_tcp 127.0.0.1 9100 + +# Same retry pattern as the first block; `|| true` on the curl cmd-subst so curl +# failure mid-loop doesn't trip `set -e`. +ok=0 +deadline=$(( $(date +%s) + 20 )) +out="" +{ set +x; } 2>/dev/null +while [ "$(date +%s)" -lt "$deadline" ]; do + curl -s --connect-timeout 1 --max-time 2 http://127.0.0.1:9100 >/dev/null 2>&1 || true + out="$(curl -s --connect-timeout 1 --max-time 2 http://127.0.0.1:9091/apisix/prometheus/metrics || true)" + if echo "$out" | grep -qE 'apisix_stream_connection_total\{route="1"\} [1-9][0-9]*'; then + ok=1 + break + fi + sleep 0.5 +done +set -x +if [ "$ok" -ne 1 ]; then echo "failed: prometheus can't work in stream subsystem" exit 1 fi diff --git a/t/lib/server.lua b/t/lib/server.lua index 309873636302..873adf67f95b 100644 --- a/t/lib/server.lua +++ b/t/lib/server.lua @@ -477,6 +477,20 @@ function _M._well_known_openid_configuration() ngx.say(openid_data) end +-- Same discovery document but advertising an end_session_endpoint, so the +-- openid-connect logout flow can be exercised without reaching a live provider. +function _M._well_known_openid_configuration_with_end_session() + local t = require("lib.test_admin") + local openid_data = json_decode(t.read_file("t/plugin/openid-connect/configuration.json")) + if not openid_data then + ngx.status = 500 + ngx.say("failed to decode openid discovery fixture") + return + end + openid_data.end_session_endpoint = "https://samples.auth0.com/v2/logout" + ngx.say(json_encode(openid_data)) +end + function _M.google_logging_token() local args = ngx.req.get_uri_args() local args_token_type = args.token_type or "Bearer" diff --git a/t/plugin/openid-connect.t b/t/plugin/openid-connect.t index c018dc977cb4..b71c7dea3edb 100644 --- a/t/plugin/openid-connect.t +++ b/t/plugin/openid-connect.t @@ -1384,9 +1384,10 @@ x-userinfo: ey.* "openid-connect": { "client_id": "kbyuFDidLLm280LIwVFiazOqjO3ty8KH", "client_secret": "60Op4HFM0I8ajz0WdiStAbziZ-VFQttXuxixHHs2R7r7-CW8GR79l-mmLqMhc-Sa", - "discovery": "https://samples.auth0.com/.well-known/openid-configuration", + "discovery": "http://127.0.0.1:1980/.well-known/openid-configuration", "redirect_uri": "https://iresty.com", "post_logout_redirect_uri": "https://iresty.com", + "ssl_verify": false, "scope": "openid profile", "session": { "secret": "jwcE5v3pM9VhqLxmxFOH9uZaLo8u7KQK" @@ -1414,8 +1415,7 @@ passed -=== TEST 36: Check whether auth0 can redirect normally using post_logout_redirect_uri configuration ---- custom_trusted_cert: /etc/ssl/certs/ca-certificates.crt +=== TEST 36: Redirect to post_logout_redirect_uri when provider has no end_session_endpoint --- config location /t { content_by_lua_block { @@ -1424,9 +1424,9 @@ passed local uri = "http://127.0.0.1:" .. ngx.var.server_port .. "/logout" local res, err = httpc:request_uri(uri, {method = "GET"}) ngx.status = res.status - local location = res.headers['Location'] - if location and string.find(location, 'https://iresty.com') ~= -1 and - string.find(location, 'post_logout_redirect_uri=https://iresty.com') ~= -1 then + local location = ngx.unescape_uri(res.headers['Location'] or "") + if location:find('https://iresty.com', 1, true) and + location:find('post_logout_redirect_uri=https://iresty.com', 1, true) then ngx.say(true) end } @@ -1447,11 +1447,12 @@ true ngx.HTTP_PUT, [[{ "plugins": { "openid-connect": { - "client_id": "942299072001-vhduu1uljmdhhbbp7g22m3qsmo246a75.apps.googleusercontent.com", - "client_secret": "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", - "discovery": "https://accounts.google.com/.well-known/openid-configuration", + "client_id": "kbyuFDidLLm280LIwVFiazOqjO3ty8KH", + "client_secret": "60Op4HFM0I8ajz0WdiStAbziZ-VFQttXuxixHHs2R7r7-CW8GR79l-mmLqMhc-Sa", + "discovery": "http://127.0.0.1:1980/.well-known/openid-configuration-with-end-session", "redirect_uri": "https://iresty.com", "post_logout_redirect_uri": "https://iresty.com", + "ssl_verify": false, "scope": "openid profile", "session": { "secret": "jwcE5v3pM9VhqLxmxFOH9uZaLo8u7KQK" @@ -1479,8 +1480,7 @@ passed -=== TEST 38: Check whether google can redirect normally using post_logout_redirect_uri configuration ---- custom_trusted_cert: /etc/ssl/certs/ca-certificates.crt +=== TEST 38: Redirect to end_session_endpoint with post_logout_redirect_uri when provider exposes it --- config location /t { content_by_lua_block { @@ -1489,9 +1489,9 @@ passed local uri = "http://127.0.0.1:" .. ngx.var.server_port .. "/logout" local res, err = httpc:request_uri(uri, {method = "GET"}) ngx.status = res.status - local location = res.headers['Location'] - if location and string.find(location, 'https://iresty.com') ~= -1 and - string.find(location, 'post_logout_redirect_uri=https://iresty.com') ~= -1 then + local location = ngx.unescape_uri(res.headers['Location'] or "") + if location:find('https://samples.auth0.com/v2/logout', 1, true) and + location:find('post_logout_redirect_uri=https://iresty.com', 1, true) then ngx.say(true) end } diff --git a/t/xrpc/prometheus.t b/t/xrpc/prometheus.t index cc267ac6c06a..c5897192280e 100644 --- a/t/xrpc/prometheus.t +++ b/t/xrpc/prometheus.t @@ -145,9 +145,18 @@ passed ngx.say("failed to get animals: ", err) return end + + -- metrics are accumulated in a per-worker counter and flushed + -- to the shared dict by an ngx.timer.every(1, ...); once this + -- block ends, the only remaining flush is the premature timer + -- run when the HUP reload retires the stream worker, which races + -- with (and can lose to) the next block's scrape. Wait for a + -- regular flush before the block ends instead. + ngx.sleep(2) } } --- response_body +--- timeout: 5 --- stream_conf_enable diff --git a/t/xrpc/redis.t b/t/xrpc/redis.t index afb2f40e67ee..9d4e9759b000 100644 --- a/t/xrpc/redis.t +++ b/t/xrpc/redis.t @@ -242,7 +242,12 @@ hget animals: bark local begin = tonumber(results[3]) for j = 1, 4 do local incred = results[3 + j] - if incred ~= results[2 + j] + 1 then + -- on a fresh redis the first pipeline's GET returns + -- ngx.null (the counter doesn't exist yet), skip the + -- comparison for it instead of doing arithmetic on a + -- userdata value + local prev = tonumber(results[2 + j]) + if prev and incred ~= prev + 1 then ngx.log(ngx.ERR, cjson.encode(results)) end end