spacewander commented on code in PR #8601:
URL: https://github.com/apache/apisix/pull/8601#discussion_r1061188025
##########
t/plugin/hmac-auth3.t:
##########
@@ -755,3 +755,146 @@ apisix:
--- response_body
my-secret-key
IRWpPjbDq5BCgHyIllnOMA==
+
+
+
+=== TEST 15: set hmac-auth conf: secret_key uses secret ref
+--- request
+GET /t
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ -- put secret vault config
+ local code, body = t('/apisix/admin/secrets/vault/test1',
+ ngx.HTTP_PUT,
+ [[{
+ "uri": "http://127.0.0.1:8200",
+ "prefix" : "kv/apisix",
+ "token" : "root"
+ }]],
+ [[{
+ "value": {
+ "uri": "http://127.0.0.1:8200",
+ "prefix" : "kv/apisix",
+ "token" : "root"
+ },
+ "key": "/apisix/secrets/vault/test1"
+ }]]
+ )
+
+ if code >= 300 then
+ ngx.status = code
+ return ngx.say(body)
+ end
+
+ -- change consumer with secrets ref: vault
+ code, body = t('/apisix/admin/consumers',
+ ngx.HTTP_PUT,
+ [[{
+ "username": "jack",
+ "plugins": {
+ "hmac-auth": {
+ "access_key": "my-access-key",
+ "secret_key":
"$secret://vault/test1/jack/secret_key"
+ }
+ }
+ }]]
+ )
+ if code >= 300 then
+ ngx.status = code
+ return ngx.say(body)
+ end
+
+ -- set route
+ code, body = t('/apisix/admin/routes/1',
Review Comment:
Could you move the new tests to a new file?
> When the test file is too large, for example > 800 lines, you should split
it to a new file. Please take a look at t/plugin/limit-conn.t and
t/plugin/limit-conn2.t.
https://github.com/apache/apisix/blob/master/CONTRIBUTING.md#check-code-style-and-test-case-style
##########
t/plugin/basic-auth.t:
##########
@@ -452,3 +452,99 @@ GET /echo
Authorization: Basic Zm9vOmJhcg==
--- response_headers
Authorization: Basic Zm9vOmJhcg==
+
+
+
+=== TEST 22: set basic-auth conf: password uses secret ref
+--- request
+GET /t
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ -- put secret vault config
+ local code, body = t('/apisix/admin/secrets/vault/test1',
+ ngx.HTTP_PUT,
+ [[{
+ "uri": "http://127.0.0.1:8200",
+ "prefix" : "kv/apisix",
+ "token" : "root"
+ }]],
+ [[{
Review Comment:
We don't need to check the response, as it is checked in the t/admin tests.
##########
t/plugin/hmac-auth3.t:
##########
@@ -755,3 +755,146 @@ apisix:
--- response_body
my-secret-key
IRWpPjbDq5BCgHyIllnOMA==
+
+
+
+=== TEST 15: set hmac-auth conf: secret_key uses secret ref
+--- request
+GET /t
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ -- put secret vault config
+ local code, body = t('/apisix/admin/secrets/vault/test1',
+ ngx.HTTP_PUT,
+ [[{
+ "uri": "http://127.0.0.1:8200",
+ "prefix" : "kv/apisix",
+ "token" : "root"
+ }]],
+ [[{
Review Comment:
Ditto
--
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]