mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
fix(e2e): validate fixture cleanup interval
This commit is contained in:
@@ -16,6 +16,20 @@ openclaw_plugins_read_positive_int_env() {
|
||||
printf "%s\n" "$((10#$value))"
|
||||
}
|
||||
|
||||
openclaw_plugins_read_nonnegative_decimal_env() {
|
||||
local name="${1:?missing environment variable name}"
|
||||
local fallback="${2:?missing fallback value}"
|
||||
local value="${!name-}"
|
||||
if [[ -z "${!name+x}" ]]; then
|
||||
value="$fallback"
|
||||
fi
|
||||
if [[ ! "$value" =~ ^[0-9]+([.][0-9]+)?$ ]]; then
|
||||
echo "invalid $name: $value" >&2
|
||||
return 2
|
||||
fi
|
||||
printf "%s\n" "$value"
|
||||
}
|
||||
|
||||
openclaw_plugins_cleanup_fixture_servers() {
|
||||
local pid_file
|
||||
local pid
|
||||
@@ -47,9 +61,9 @@ openclaw_plugins_fixture_process_alive() {
|
||||
openclaw_plugins_stop_fixture_process() {
|
||||
local pid="$1"
|
||||
local _
|
||||
local attempts
|
||||
local attempts interval
|
||||
attempts="$(openclaw_plugins_read_positive_int_env OPENCLAW_PLUGINS_FIXTURE_STOP_ATTEMPTS 40)" || return $?
|
||||
local interval="${OPENCLAW_PLUGINS_FIXTURE_STOP_INTERVAL_SECONDS:-0.25}"
|
||||
interval="$(openclaw_plugins_read_nonnegative_decimal_env OPENCLAW_PLUGINS_FIXTURE_STOP_INTERVAL_SECONDS 0.25)" || return $?
|
||||
if declare -F openclaw_e2e_stop_process >/dev/null 2>&1; then
|
||||
openclaw_e2e_stop_process "$pid"
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user