mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
fix(e2e): use jq to count DigitalOcean droplets instead of grep (#3125)
The previous grep -o '"id":[0-9]*' pattern matched all numeric id fields in the droplets JSON response (including nested image/region/size ids), overcounting droplets by 2x and falsely reporting quota exhaustion. Replace with jq '.droplets | length' which correctly counts only top-level droplet objects. This restores DigitalOcean capacity detection so e2e runs can use available droplet slots. -- qa/e2e-tester Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
This commit is contained in:
parent
7f16619a7c
commit
e98a3a5c4b
1 changed files with 1 additions and 1 deletions
|
|
@ -381,7 +381,7 @@ _digitalocean_max_parallel() {
|
|||
local _account_json _limit _existing _available
|
||||
_account_json=$(_do_curl_auth -sf "${_DO_API}/account" 2>/dev/null) || { printf '3'; return 0; }
|
||||
_limit=$(printf '%s' "${_account_json}" | grep -o '"droplet_limit":[0-9]*' | grep -o '[0-9]*$') || { printf '3'; return 0; }
|
||||
_existing=$(_do_curl_auth -sf "${_DO_API}/droplets?per_page=200" 2>/dev/null | grep -o '"id":[0-9]*' | wc -l | tr -d ' ') || { printf '3'; return 0; }
|
||||
_existing=$(_do_curl_auth -sf "${_DO_API}/droplets?per_page=200" 2>/dev/null | jq -r '.droplets | length' 2>/dev/null) || { printf '3'; return 0; }
|
||||
_available=$(( _limit - _existing ))
|
||||
if [ "${_available}" -lt 1 ]; then
|
||||
log_warn "DigitalOcean droplet limit reached: ${_existing}/${_limit} droplets in use (0 available)" >&2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue