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/06/09 02:25:37 UTC

[GitHub] [apisix] spacewander commented on a diff in pull request #7201: fix: add debug yaml validation

spacewander commented on code in PR #7201:
URL: https://github.com/apache/apisix/pull/7201#discussion_r893012680


##########
apisix/debug.lua:
##########
@@ -204,8 +260,9 @@ local function sync_debug_status(premature)
         return
     end
 
-    read_debug_yaml()
-    sync_debug_hooks()
+    if read_debug_yaml() then

Review Comment:
   ```
   if not ... then
        return
   end
   ```
   
   would be better?



##########
t/debug/hook.t:
##########
@@ -127,3 +132,28 @@ hello world
 --- error_log
 filter(): call require("apisix.plugin").filter() args:{
 filter(): call require("apisix.plugin").filter() return:{
+
+
+=== TEST 5: missing hook_conf
+--- debug_config
+basic:
+  enable: true
+http_filter:
+  enable: true         # enable or disable this feature
+  enable_header_name: X-APISIX-Dynamic-Debug # the header name of dynamic enable
+
+hook_test:                      # module and function list, name: hook_test
+    apisix.plugin:              # required module name
+    - filter                    # function name
+
+#END
+--- request
+GET /hello
+--- more_headers
+Host: foo.com
+--- response_body
+hello world
+--- no_error_log
+[error]

Review Comment:
   We can't check there is no `[error]` because `failed to validate debug config property "hook_conf" is required` is an error level log.



-- 
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