fix(e2e): use jq to count DigitalOcean droplets instead of grep (#3125)
Some checks are pending
CLI Release / Build and release CLI (push) Waiting to run
Lint / ShellCheck (push) Waiting to run
Lint / Biome Lint (push) Waiting to run
Lint / macOS Compatibility (push) Waiting to run

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:
A 2026-03-31 02:32:33 -07:00 committed by GitHub
parent 7f16619a7c
commit e98a3a5c4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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