zaunist commented on a change in pull request #6092:
URL: https://github.com/apache/apisix/pull/6092#discussion_r785656254
##########
File path: t/admin/plugin-configs.t
##########
@@ -430,3 +430,124 @@ passed
--- response_body
{"error_msg":"invalid configuration: property \"labels\" validation failed:
wrong type: expected object, got string"}
--- error_code: 400
+
+
+
+=== TEST 10: set plugin-configs(id: 1)
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local etcd = require("apisix.core.etcd")
+ local code, body = t('/apisix/admin/plugin_configs/1',
+ ngx.HTTP_PUT,
+ [[{
+ "plugins": {
+ "limit-count": {
+ "count": 2,
+ "time_window": 60,
+ "rejected_code": 503,
+ "key": "remote_addr"
+ }
+ }
+ }]]
+ )
+
+ ngx.status = code
+ ngx.say(body)
+
+ local res = assert(etcd.get('/plugin_configs/1'))
+ local create_time = res.body.node.value.create_time
+ assert(create_time ~= nil, "create_time is nil")
+ local update_time = res.body.node.value.update_time
+ assert(update_time ~= nil, "update_time is nil")
+ }
+ }
+--- response_body
+passed
+
+
+
+=== TEST 11: set route(id: 1)
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PUT,
+ [[{
+ "plugin_config_id": 1,
+ "uri": "/index.html",
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:8080": 1
+ },
+ "type": "roundrobin"
+ }
+ }]]
+ )
+
+ ngx.status = code
+ ngx.say(body)
+ }
+ }
+--- response_body
+passed
+
+
+
+=== TEST 12: delete-plugin configs failed(id: 1)
+--- config
+ location /t {
+ content_by_lua_block {
+ ngx.sleep(0.3)
Review comment:
The current step depends on the previous steps, so set a short time for
etcd to sync data.
--
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]