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/04/15 04:23:47 UTC

[GitHub] [apisix] tzssangglass commented on issue #6848: bug: http-logger 和grpc-transcode 同时使用BUG

tzssangglass commented on issue #6848:
URL: https://github.com/apache/apisix/issues/6848#issuecomment-1099838596

   I was not able to reproduce your problem with the following test cases:
   
   ```
   BEGIN {
       if ($ENV{TEST_NGINX_CHECK_LEAK}) {
           $SkipReason = "unavailable for the hup tests";
   
       } else {
           $ENV{TEST_NGINX_USE_HUP} = 1;
           undef $ENV{TEST_NGINX_USE_STAP};
       }
   }
   
   use t::APISIX 'no_plan';
   
   repeat_each(1);
   no_long_string();
   no_shuffle();
   no_root_location();
   log_level('debug');
   
   run_tests;
   
   __DATA__
   
   === TEST 1: set proto(id: 1)
   --- config
       location /t {
           content_by_lua_block {
               local t = require("lib.test_admin").test
               local code, body = t('/apisix/admin/proto/1',
                    ngx.HTTP_PUT,
                    [[{
                       "content" : "syntax = \"proto3\";
                         package helloworld;
                         service Greeter {
                             rpc SayHello (HelloRequest) returns (HelloReply) {}
                             rpc Plus (PlusRequest) returns (PlusReply) {}
                             rpc SayHelloAfterDelay (HelloRequest) returns (HelloReply) {}
                         }
   
                         message HelloRequest {
                             string name = 1;
                         }
                         message HelloReply {
                             string message = 1;
                            }
                         message PlusRequest {
                             int64 a = 1;
                             int64 b = 2;
                         }
                         message PlusReply {
                             int64 result = 1;
                         }"
                      }]]
                   )
   
               if code >= 300 then
                   ngx.status = code
               end
               ngx.say(body)
           }
       }
   --- request
   GET /t
   --- response_body
   passed
   --- no_error_log
   [error]
   
   
   
   === TEST 2: set routes(with http-logger)
   --- 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,
                   [[{
                       "methods": ["GET"],
                       "uri": "/grpc_plus",
                       "plugins": {
                           "grpc-transcode": {
                               "proto_id": "1",
                               "service": "helloworld.Greeter",
                               "method": "Plus",
                               "pb_option":["int64_as_string", "enum_as_name"]
                           },
                           "http-logger": {
                               "uri": "http://127.0.0.1:1980/log",
                               "batch_max_size": 1,
                               "include_resp_body": true
                           }
                       },
                       "upstream": {
                           "scheme": "grpc",
                           "type": "roundrobin",
                           "nodes": {
                               "127.0.0.1:50051": 1
                           }
                       }
                   }]]
               )
   
               if code >= 300 then
                   ngx.status = code
               end
               ngx.say(body)
           }
       }
   --- request
   GET /t
   --- response_body
   passed
   --- no_error_log
   [error]
   
   
   
   === TEST 3: hit route
   --- request
   GET /grpc_plus?a=1&b=2
   --- response_body eval
   qr/\{"result":3\}/
   --- no_error_log
   [error]
   
   ```


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