@@ -50,6 +50,7 @@ error() {
5050}
5151
5252BASE_URL=" ${BASE_URL:- http:// localhost: 32888} "
53+ BASE_API_URL=" ${BASE_URL} /v1"
5354API_KEY_HEADER=()
5455if [[ -n " ${OPEN_SANDBOX_API_KEY:- } " ]]; then
5556 API_KEY_HEADER=(-H " OPEN-SANDBOX-API-KEY: ${OPEN_SANDBOX_API_KEY} " )
@@ -68,7 +69,7 @@ wait_for_running() {
6869 local deadline=$(( SECONDS + 10 ))
6970 while true ; do
7071 local resp
71- resp=$( curl_json " ${BASE_URL } /sandboxes/${SANDBOX_ID} " )
72+ resp=$( curl_json " ${BASE_API_URL } /sandboxes/${SANDBOX_ID} " )
7273 local state
7374 state=$( python - << 'PY ' "${resp}"
7475import json,sys
@@ -97,7 +98,7 @@ wait_for_expired() {
9798 local deadline=$(( SECONDS + 90 ))
9899 while true ; do
99100 local resp body status
100- resp=$( curl_json_status " ${BASE_URL } /sandboxes/${sandbox_id} " )
101+ resp=$( curl_json_status " ${BASE_API_URL } /sandboxes/${sandbox_id} " )
101102 status=" ${resp##* $' \n ' } "
102103 body=" ${resp% $' \n ' * } "
103104 if [[ " ${status} " == " 404" ]]; then
@@ -128,7 +129,7 @@ step "Create sandbox (60s TTL)"
128129create_resp=$( curl_json \
129130 -H ' Content-Type: application/json' \
130131 -d " ${create_payload} " \
131- " ${BASE_URL } /sandboxes" )
132+ " ${BASE_API_URL } /sandboxes" )
132133
133134SANDBOX_ID=$( python - << 'PY ' "${create_resp}"
134135import json,sys
@@ -166,7 +167,7 @@ list_resp=$(curl_json \
166167 --data-urlencode " metadata=hello=world" \
167168 --data-urlencode " page=1" \
168169 --data-urlencode " pageSize=10" \
169- " ${BASE_URL } /sandboxes" )
170+ " ${BASE_API_URL } /sandboxes" )
170171
171172python - << 'PY ' "${list_resp}" "${SANDBOX_ID}"
172173import json,sys
@@ -196,7 +197,7 @@ renew_resp=$(curl_json \
196197 -X POST \
197198 -H ' Content-Type: application/json' \
198199 -d " ${renew_payload} " \
199- " ${BASE_URL } /sandboxes/${SANDBOX_ID} /renew-expiration" )
200+ " ${BASE_API_URL } /sandboxes/${SANDBOX_ID} /renew-expiration" )
200201renewed=$( python - << 'PY ' "${renew_resp}"
201202import json,sys
202203body=json.loads(sys.argv[1])
206207echo " Expiration renewed to: ${renewed} "
207208
208209step " Request endpoint on port 8080"
209- endpoint_resp=$( curl_json " ${BASE_URL } /sandboxes/${SANDBOX_ID} /endpoints/8080" )
210+ endpoint_resp=$( curl_json " ${BASE_API_URL } /sandboxes/${SANDBOX_ID} /endpoints/8080" )
210211endpoint=$( python - << 'PY ' "${endpoint_resp}"
211212import json,sys
212213body=json.loads(sys.argv[1])
216217echo " Endpoint: ${endpoint} "
217218
218219step " Delete sandbox"
219- curl_json -X DELETE " ${BASE_URL } /sandboxes/${SANDBOX_ID} "
220+ curl_json -X DELETE " ${BASE_API_URL } /sandboxes/${SANDBOX_ID} "
220221echo " Sandbox ${SANDBOX_ID} deleted."
221222
222223step " Create short-lived sandbox (60s TTL) for auto-expiration"
@@ -232,7 +233,7 @@ create_payload_short='{
232233create_resp_short=$( curl_json \
233234 -H ' Content-Type: application/json' \
234235 -d " ${create_payload_short} " \
235- " ${BASE_URL } /sandboxes" )
236+ " ${BASE_API_URL } /sandboxes" )
236237
237238SANDBOX_ID=$( python - << 'PY ' "${create_resp_short}"
238239import json,sys
0 commit comments