kingluo commented on code in PR #9523:
URL: https://github.com/apache/apisix/pull/9523#discussion_r1200199036
##########
t/fips/jwt-auth.t:
##########
@@ -142,10 +142,9 @@ passed
)
ngx.status = code
- ngx.print(res)
}
}
---- error_code: 500
+--- error_code: 401
Review Comment:
> why `ngx.print(res)` will return 500?
Because that's the behavior of `lib.test_admin.test`: if status is 401, then
the third ret is headers hash table, but not normal response body string, so
print will fail:
```
2023/05/22 15:53:30 [error] 980977#980977: *3 lua entry thread aborted:
runtime error: content_by_lua(nginx.conf:259):18: bad argument #1 to 'print'
(non-
array table found)" (req 0)
# stack traceback:
# coroutine 0:
# [C]: in function 'print'
# content_by_lua(nginx.conf:259):18: in main chunk, client: 127.0.0.1,
server: localhost, request: "GET /t HTTP/1.1", host: "localhost"
```
Note that all test cases are clone of original ones, but with fail post
conditions added. Just like what I said before.
So we need to fix the test cases to fit our need, e.g. non-500 error.
https://github.com/apache/apisix/blob/a943c036987aa2e9a34f05060015ff65b8913345/t/lib/test_admin.lua#L200-L202
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]