You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/16 12:29:00 UTC

[GitHub] [apisix] spacewander commented on a change in pull request #6092: feat(plugin config): add dependency for delete plugin config

spacewander commented on a change in pull request #6092:
URL: https://github.com/apache/apisix/pull/6092#discussion_r785434259



##########
File path: apisix/admin/plugin_config.lua
##########
@@ -100,13 +102,33 @@ end
 
 
 function _M.delete(id)
+    if not id then
+        return 400, {error_msg = "missing plugin config id"}
+    end
+
+    local routes, routes_ver = get_routes()
+    core.log.info("routes: ", core.json.delay_encode(routes, true))

Review comment:
       Is it necessary to dump all the routes?

##########
File path: t/admin/delete-plugin-configs.t
##########
@@ -0,0 +1,174 @@
+#
+# 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_root_location();
+
+run_tests();
+
+__DATA__
+
+=== TEST 1: 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"
+                        }
+                    }
+                }]],
+                [[{

Review comment:
       We don't need to check the response in every test.

##########
File path: t/admin/delete-plugin-configs.t
##########
@@ -0,0 +1,174 @@
+#

Review comment:
       Could we add it to `t/admin/plugin-configs.t`?




-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org