spacewander commented on code in PR #7514:
URL: https://github.com/apache/apisix/pull/7514#discussion_r926427332
##########
apisix/control/v1.lua:
##########
@@ -276,6 +277,28 @@ function _M.dump_service_info()
return 200, info
end
+function _M.dump_all_plugin_metadata()
+ local names = plugins.get_plugins_list()
Review Comment:
Better to use another way to do it. Maybe a new method in the `plugin`
module or some other way.
We can't let the module in control-api require the module in admin-api. They
are at the same level.
##########
docs/en/latest/control-api.md:
##########
@@ -451,3 +451,42 @@ Dumps the Upstream with the specified `upstream_id`:
"modifiedIndex":1225
}
```
+
+
+### GET /v1/plugin_metadatas
+
+Introduced in [v2.15](https://github.com/apache/apisix/releases/tag/2.15).
Review Comment:
Should be `2.15.0`. We have a patch version for the latest releases.
##########
t/control/plugin-metadata.t:
##########
@@ -0,0 +1,124 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+
+repeat_each(1);
+no_long_string();
+no_root_location();
+no_shuffle();
+log_level("info");
Review Comment:
We don't need to repeat the settings in
https://github.com/apache/apisix/blob/44d20c391767d3d42c5111ea7ef6318e84633996/t/APISIX.pm#L23-L28
##########
t/control/plugin-metadata.t:
##########
@@ -0,0 +1,124 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use t::APISIX 'no_plan';
+
+repeat_each(1);
+no_long_string();
+no_root_location();
+no_shuffle();
+log_level("info");
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: add plugin metadatas
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local _, body = t('/apisix/admin/plugin_metadata/example-plugin',
+ ngx.HTTP_PUT,
+ [[{
+ "skey": "val",
+ "ikey": 1
+ }]],
+ [[{
+ "node": {
+ "value": {
+ "skey": "val",
+ "ikey": 1
+ }
+ },
+ "action": "set"
+ }]]
+ )
+
+ ngx.say(body)
+
+ local _, body = t('/apisix/admin/plugin_metadata/file-logger',
+ ngx.HTTP_PUT,
+ [[
+ {"log_format": {"upstream_response_time":
"$upstream_response_time"}}
+ ]]
+ )
+ ngx.say(body)
+ }
+ }
+--- request
Review Comment:
We can set the repeated sections in `add_block_preprocessor` like the other
test files:
https://github.com/apache/apisix/blob/44d20c391767d3d42c5111ea7ef6318e84633996/t/deployment/conf_server.t#L28
--
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]