This is an automated email from the ASF dual-hosted git repository.

Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 9ef717e662 ci: wait for ZooKeeper deployment rollout in Dubbo ingress 
test (#7427)
9ef717e662 is described below

commit 9ef717e662c06b9ca54cd21198e0a17d97ee55b2
Author: BobSong <[email protected]>
AuthorDate: Sun Oct 4 19:07:40 2026 +0800

    ci: wait for ZooKeeper deployment rollout in Dubbo ingress test (#7427)
    
    Co-authored-by: BobSong-dev <[email protected]>
---
 .github/workflows/integrated-test-k8s-ingress.yml  |  4 +
 .../script/build_k8s_cluster.sh                    |  2 +-
 .../script/build_k8s_cluster_test.sh               | 91 ++++++++++++++++++++++
 3 files changed, 96 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/integrated-test-k8s-ingress.yml 
b/.github/workflows/integrated-test-k8s-ingress.yml
index a079b62125..2f85b012d4 100644
--- a/.github/workflows/integrated-test-k8s-ingress.yml
+++ b/.github/workflows/integrated-test-k8s-ingress.yml
@@ -140,6 +140,10 @@ jobs:
         with:
           go-version: 1.17.x
 
+      - name: Test Dubbo deployment readiness script
+        if: matrix.case == 'shenyu-integrated-test-k8s-ingress-apache-dubbo'
+        run: bash 
./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/script/build_k8s_cluster_test.sh
+
       - name: Install k8s
         run: |
           go install sigs.k8s.io/[email protected]
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/script/build_k8s_cluster.sh
 
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/script/build_k8s_cluster.sh
index 1ff67d7728..adf4d4013a 100644
--- 
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/script/build_k8s_cluster.sh
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/script/build_k8s_cluster.sh
@@ -21,7 +21,7 @@ set -euo pipefail
 kind load docker-image "shenyu-examples-apache-dubbo-service:latest"
 kind load docker-image 
"apache/shenyu-integrated-test-k8s-ingress-apache-dubbo:latest"
 kubectl apply -f 
./shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service/k8s/shenyu-zookeeper.yml
-kubectl wait --for=condition=Ready pod -l app=shenyu-zk -n shenyu-ingress
+kubectl rollout status deployment/shenyu-zk -n shenyu-ingress --timeout=120s
 kubectl apply -f 
./shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service/k8s/shenyu-examples-dubbo.yml
 kubectl apply -f 
./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/deploy/deploy-shenyu.yaml
 kubectl apply -f 
./shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service/k8s/ingress.yml
diff --git 
a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/script/build_k8s_cluster_test.sh
 
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/script/build_k8s_cluster_test.sh
new file mode 100644
index 0000000000..dc26c10db3
--- /dev/null
+++ 
b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/script/build_k8s_cluster_test.sh
@@ -0,0 +1,91 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set -euo pipefail
+
+readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+readonly BUILD_SCRIPT="${1:-${SCRIPT_DIR}/build_k8s_cluster.sh}"
+readonly K8S_TEST_LOG_FILE="$(mktemp)"
+export K8S_TEST_LOG_FILE
+trap 'rm -f -- "${K8S_TEST_LOG_FILE}"' EXIT
+
+kind() {
+  printf 'kind %s\n' "$*" >> "${K8S_TEST_LOG_FILE}"
+  if [[ "${K8S_TEST_CASE}" == load_failure ]]; then
+    return 17
+  fi
+}
+
+kubectl() {
+  printf 'kubectl %s\n' "$*" >> "${K8S_TEST_LOG_FILE}"
+  case "$*" in
+    'apply -f 
./shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service/k8s/shenyu-zookeeper.yml')
+      if [[ "${K8S_TEST_CASE}" == apply_failure ]]; then
+        return 19
+      fi
+      ;;
+    'wait --for=condition=Ready pod -l app=shenyu-zk -n shenyu-ingress')
+      # A Deployment can exist before its Pod. The old command fails 
immediately.
+      echo 'error: no matching resources found' >&2
+      return 1
+      ;;
+    'rollout status deployment/shenyu-zk -n shenyu-ingress --timeout=120s')
+      if [[ "${K8S_TEST_CASE}" == rollout_timeout ]]; then
+        echo 'error: timed out waiting for the condition' >&2
+        return 1
+      elif [[ "${K8S_TEST_CASE}" == rollout_forbidden ]]; then
+        echo 'Error from server (Forbidden): deployments.apps is forbidden' >&2
+        return 13
+      fi
+      ;;
+    *)
+      [[ "$1" == apply ]] || return 23
+      ;;
+  esac
+}
+export -f kind kubectl
+
+readonly EXPECTED_COMMANDS="$(printf '%s\n' \
+  'kind load docker-image shenyu-examples-apache-dubbo-service:latest' \
+  'kind load docker-image 
apache/shenyu-integrated-test-k8s-ingress-apache-dubbo:latest' \
+  'kubectl apply -f 
./shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service/k8s/shenyu-zookeeper.yml'
 \
+  'kubectl rollout status deployment/shenyu-zk -n shenyu-ingress 
--timeout=120s' \
+  'kubectl apply -f 
./shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service/k8s/shenyu-examples-dubbo.yml'
 \
+  'kubectl apply -f 
./shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/deploy/deploy-shenyu.yaml'
 \
+  'kubectl apply -f 
./shenyu-examples/shenyu-examples-dubbo/shenyu-examples-apache-dubbo-service/k8s/ingress.yml')"
+
+run_case() {
+  local scenario="$1" expected_status="$2" expected_count="$3"
+  local status=0 actual expected output
+  : > "${K8S_TEST_LOG_FILE}"
+  output="$(K8S_TEST_CASE="${scenario}" bash "${BUILD_SCRIPT}" 2>&1)" || 
status=$?
+  actual="$(< "${K8S_TEST_LOG_FILE}")"
+  expected="$(printf '%s\n' "${EXPECTED_COMMANDS}" | head -n 
"${expected_count}")"
+  if [[ "${status}" != "${expected_status}" || "${actual}" != "${expected}" 
]]; then
+    printf 'Unexpected result for %s: exit=%s, expected=%s\n%s\n%s\n' \
+      "${scenario}" "${status}" "${expected_status}" "${output}" "${actual}" 
>&2
+    exit 1
+  fi
+  printf '%s case passed\n' "${scenario}"
+}
+
+run_case delayed_pod_success 0 7
+run_case rollout_timeout 1 4
+run_case rollout_forbidden 13 4
+run_case apply_failure 19 3
+run_case load_failure 17 1

Reply via email to