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

   Unable to reproduce, the test case I used
   
   ```
   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 etcd = require("apisix.core.etcd")
               local code, body = t('/apisix/admin/proto/1',
                    ngx.HTTP_PUT,
                    [[{
                       "content" : "syntax = \"proto3\";
                         package helloworld;
                         service Greeter {
                             rpc SayHello (HelloRequest) returns (HelloReply) {}
                         }
                         message HelloRequest {
                             string name = 1;
                         }
                         message HelloReply {
                             string message = 1;
                            }"
                      }]]
                   )
   
               if code >= 300 then
                   ngx.status = code
               end
               ngx.say(body)
   
               local res = assert(etcd.get('/proto/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")
   
           }
       }
   --- request
   GET /t
   --- response_body
   passed
   --- no_error_log
   [error]
   
   
   
   === TEST 4: set routes(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,
                   [[{
                       "methods": ["GET", "POST"],
                       "uri": "/grpctest",
                       "plugins": {
                           "grpc-transcode": {
                               "proto_id": "1",
                               "service": "helloworld.Greeter",
                               "method": "SayHello"
                           }
                       },
                       "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 5: hit route
   --- request
   GET /grpctest?name=world
   --- response_body eval
   qr/\{"message":"Hello world"\}/
   --- no_error_log
   [error]
   ```
   
   and using `t/grpc_server_example` under the APISIX repository as the grpc 
upstream, start the command as follows:
   
   ```
   cd t/grpc_server_example
   
   CGO_ENABLED=0 go build
   ./grpc_server_example \
       -grpc-address :50051 -grpcs-address :50052 -grpcs-mtls-address :50053 \
       -crt ../certs/apisix.crt -key ../certs/apisix.key -ca 
../certs/mtls_ca.crt \
       > grpc_server_example.log 2>&1 || (cat grpc_server_example.log && exit 
1)&
   
   cd ../../
   ```
   
   For example, I don't know what the `meeting` and `watch` folders are.
   


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

Reply via email to