fix(tests): X-Test-Sub → X-Auth-Token во всех тест-скриптах, cleanup для test59.sh
This commit is contained in:
@@ -64,7 +64,7 @@ create_call() {
|
||||
local sub="$1"
|
||||
local body="$2"
|
||||
curl -s -w "\n%{http_code}" --max-time 60 -X POST "${BASE}/functions" \
|
||||
-H "X-Test-Sub: ${sub}" -H 'Content-Type: application/json' -d "$body"
|
||||
-H "X-Auth-Token: ${sub}" -H 'Content-Type: application/json' -d "$body"
|
||||
}
|
||||
|
||||
invoke_call() {
|
||||
@@ -76,7 +76,7 @@ invoke_call() {
|
||||
err_file=$(mktemp)
|
||||
rc=0
|
||||
http_code=$(curl -sS -o "$out_file" -w "%{http_code}" --max-time 60 -X POST "${BASE}/functions/${name}/invoke" \
|
||||
-H "X-Test-Sub: ${sub}" -H 'Content-Type: application/json' -d "$body" 2>"$err_file") || rc=$?
|
||||
-H "X-Auth-Token: ${sub}" -H 'Content-Type: application/json' -d "$body" 2>"$err_file") || rc=$?
|
||||
resp=$(cat "$out_file" 2>/dev/null || true)
|
||||
err_text=$(tr '\n' ' ' <"$err_file" | sed 's/[[:space:]]\+/ /g')
|
||||
rm -f "$out_file" "$err_file"
|
||||
@@ -243,9 +243,9 @@ R=$(create_call "$NEG_SUB" '{"name":"dup-ui","language":"python","entrypoint":"m
|
||||
CODE=$(printf '%s' "$R" | tail -1)
|
||||
([ "$CODE" = "409" ] || [ "$CODE" = "502" ]) && pass "duplicate create rejected" || fail "duplicate create -> got $CODE"
|
||||
|
||||
DC=$(curl -s -o /dev/null -w "%{http_code}" --max-time 45 -X DELETE "${BASE}/functions/dup-ui" -H "X-Test-Sub: ${NEG_SUB}")
|
||||
DC=$(curl -s -o /dev/null -w "%{http_code}" --max-time 45 -X DELETE "${BASE}/functions/dup-ui" -H "X-Auth-Token: ${NEG_SUB}")
|
||||
[ "$DC" = "200" ] && pass "first delete -> 200" || fail "first delete -> got $DC"
|
||||
DC2=$(curl -s -o /dev/null -w "%{http_code}" --max-time 45 -X DELETE "${BASE}/functions/dup-ui" -H "X-Test-Sub: ${NEG_SUB}")
|
||||
DC2=$(curl -s -o /dev/null -w "%{http_code}" --max-time 45 -X DELETE "${BASE}/functions/dup-ui" -H "X-Auth-Token: ${NEG_SUB}")
|
||||
[ "$DC2" = "404" ] && pass "second delete -> 404" || fail "second delete -> got $DC2"
|
||||
|
||||
echo ""
|
||||
@@ -274,7 +274,7 @@ else
|
||||
fail "nodejs invoke did not stabilize"
|
||||
fi
|
||||
UPD=$(curl -s -w "\n%{http_code}" --max-time 60 -X PUT "${BASE}/functions/node-ui/code" \
|
||||
-H "X-Test-Sub: ${NODE_SUB}" -H 'Content-Type: application/json' \
|
||||
-H "X-Auth-Token: ${NODE_SUB}" -H 'Content-Type: application/json' \
|
||||
-d '{"code":"module.exports = async function() { return { status: 200, body: \"node-ui-updated\" }; }"}')
|
||||
CODE=$(printf '%s' "$UPD" | tail -1)
|
||||
[ "$CODE" = "200" ] && pass "nodejs update -> 200" || fail "nodejs update -> got $CODE"
|
||||
|
||||
Reference in New Issue
Block a user