零副本 Worker 站点没有 metrics,应从聚合采样中跳过;有副本的站点采样失败仍保持硬失败。补充缺失字段诊断,避免只输出无上下文的采样失败。\n\n容量轮次和混合长稳压测现在持续监视压力采样进程;采样器提前退出时立即终止当前负载并走失败收口,避免在资源监控失效后继续造任务。\n\n验证:bash -n、ShellCheck、零副本站点测试、采样失败联动停止测试、manual-release-test。
84 lines
2.2 KiB
Bash
Executable File
84 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# shellcheck disable=SC2034 # Variables are consumed by dynamically sourced functions.
|
|
set -euo pipefail
|
|
|
|
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
|
|
tmp=$(mktemp -d)
|
|
trap 'rm -rf "$tmp"' EXIT
|
|
|
|
script=$root/scripts/cluster/run-production-acceptance.sh
|
|
awk '
|
|
/^is_release_ancestor\(\)/ { capture = 1 }
|
|
capture && /^create_and_activate_run\(\)/ { exit }
|
|
capture { print }
|
|
' "$script" >"$tmp/is-release-ancestor.sh"
|
|
|
|
# shellcheck source=/dev/null
|
|
source "$tmp/is-release-ancestor.sh"
|
|
|
|
awk '
|
|
/^workload_metrics_for_site\(\)/ { capture = 1 }
|
|
capture && /^current_max_pod_memory_mib\(\)/ { exit }
|
|
capture { print }
|
|
' "$script" >"$tmp/pressure-monitor.sh"
|
|
|
|
# shellcheck source=/dev/null
|
|
source "$tmp/pressure-monitor.sh"
|
|
|
|
cluster_root=$tmp/repository
|
|
git init -q "$cluster_root"
|
|
git -C "$cluster_root" config user.name 'Acceptance Script Test'
|
|
git -C "$cluster_root" config user.email 'acceptance-script-test@example.invalid'
|
|
git -C "$cluster_root" commit --allow-empty -qm first
|
|
first=$(git -C "$cluster_root" rev-parse HEAD)
|
|
git -C "$cluster_root" commit --allow-empty -qm second
|
|
git -C "$cluster_root" commit --allow-empty -qm third
|
|
third=$(git -C "$cluster_root" rev-parse HEAD)
|
|
|
|
is_release_ancestor "$first" "$third"
|
|
if is_release_ancestor "$third" "$first"; then
|
|
echo 'descendant release was accepted as an ancestor' >&2
|
|
exit 1
|
|
fi
|
|
if is_release_ancestor invalid "$third"; then
|
|
echo 'invalid release identifier was accepted as an ancestor' >&2
|
|
exit 1
|
|
fi
|
|
|
|
remote_kubectl() {
|
|
printf 0
|
|
}
|
|
|
|
cluster_ssh() {
|
|
echo 'zero-replica Worker attempted to collect metrics' >&2
|
|
return 1
|
|
}
|
|
|
|
namespace=easyai
|
|
if workload_metrics_for_site worker ningbo; then
|
|
echo 'zero-replica Worker site returned metrics success' >&2
|
|
exit 1
|
|
else
|
|
metrics_status=$?
|
|
fi
|
|
[[ $metrics_status == 2 ]]
|
|
|
|
long_running_load() {
|
|
while :; do
|
|
sleep 1
|
|
done
|
|
}
|
|
|
|
(sleep 1; exit 1) &
|
|
pressure_pid=$!
|
|
AI_GATEWAY_ACCEPTANCE_PROCESS_WATCH_SECONDS=1
|
|
active_load_pid=
|
|
if run_with_pressure_monitor "$pressure_pid" long_running_load; then
|
|
echo 'load continued after the pressure sampler failed' >&2
|
|
exit 1
|
|
fi
|
|
wait "$pressure_pid" >/dev/null 2>&1 || true
|
|
[[ -z $active_load_pid ]]
|
|
|
|
echo 'production_acceptance_script_tests=PASS'
|