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 2021/10/20 21:32:39 UTC

[GitHub] [apisix] bisakhmondal opened a new pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

bisakhmondal opened a new pull request #5299:
URL: https://github.com/apache/apisix/pull/5299


   ### What this PR does / why we need it:
   At present test nginx doesn't have a grpc client. That's why we were using an approach to test the gRPC proxy through a shell script with grpcurl. This pr tries to migrate the shell script to a traditional .t file for testing that is more consistent with the codebase with the help of `ngx.pipe`.
   
   requires: https://github.com/api7/grpc_server_example/pull/13
   
   ### Pre-submission checklist:
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


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



[GitHub] [apisix] bisakhmondal removed a comment on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal removed a comment on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949583076


   PS: merging https://github.com/apache/apisix/pull/5316 to test the CIs behaviour. Ideally, this should pass because the required dependency of centos 7 has been added through merging #5316 
   
   # DO NOT MERGE UNTIL
   #5308
   #5316 
   are merged
   
   ps. I'll rebase it once they are merged.


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



[GitHub] [apisix] bisakhmondal commented on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949583076


   PS: merging https://github.com/apache/apisix/pull/5316 to test the CIs behavious


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



[GitHub] [apisix] spacewander merged pull request #5299: refactor: migrate grpc proxy tests from shell to test Nginx

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #5299:
URL: https://github.com/apache/apisix/pull/5299


   


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



[GitHub] [apisix] spacewander commented on a change in pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#discussion_r733428048



##########
File path: t/node/grpc_proxy_stream.t
##########
@@ -0,0 +1,225 @@
+#
+# 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_long_string();
+no_root_location();
+no_shuffle();
+log_level("info");
+
+add_block_preprocessor(sub {
+    my ($block) = @_;
+
+    if (!$block->yaml_config) {
+        my $yaml_config = <<_EOC_;
+apisix:
+    config_center: yaml
+    node_listen:
+        - port: 9080
+          enable_http2: false
+        - port: 9081
+          enable_http2: true
+_EOC_

Review comment:
       The nginx.conf in the test is generated by test-nginx & APISIX.pm, not the yaml conf. You can find it in `t/servroot/conf/`. To enable HTTP2, you need to add `--- http2`, see https://github.com/openresty/test-nginx/blob/65141a1548e08ee89bd62d87be0bb43fa9ca954a/Changes#L37




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



[GitHub] [apisix] bisakhmondal commented on a change in pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on a change in pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#discussion_r733166756



##########
File path: t/node/grpc_proxy_stream.t
##########
@@ -0,0 +1,225 @@
+#
+# 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_long_string();
+no_root_location();
+no_shuffle();
+log_level("info");
+
+add_block_preprocessor(sub {
+    my ($block) = @_;
+
+    if (!$block->yaml_config) {
+        my $yaml_config = <<_EOC_;
+apisix:
+    config_center: yaml
+    node_listen:
+        - port: 9080
+          enable_http2: false
+        - port: 9081
+          enable_http2: true
+_EOC_
+
+        $block->set_value("yaml_config", $yaml_config);
+    }
+
+    if (!$block->request) {
+        $block->set_value("request", "GET /t");
+    }
+});
+
+run_tests;
+
+__DATA__
+
+
+=== TEST 1: Unary API gRPC
+--- apisix_yaml
+routes:
+  -
+    id: 1
+    uris:
+        - /helloworld.Greeter/SayHello
+    methods: [
+        POST
+    ]
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:50051": 1
+      type: roundrobin
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local ngx_pipe = require("ngx.pipe")
+            local proc, err = ngx_pipe.spawn("grpcurl -plaintext -d '{\"name\":\"apisix\"}' 127.0.0.1:50051 helloworld.Greeter.SayHello")

Review comment:
       Tested locally, It works (right now it points to the example upstream server directly). We just have to change the port from 50051 to the port that has `enable_http2` set as true.




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



[GitHub] [apisix] bisakhmondal edited a comment on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal edited a comment on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-951078571


   CI failure is not related to this PR.
   
   Requesting @spacewander to retrigger te CIs.
   Thanks!


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



[GitHub] [apisix] bisakhmondal commented on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949394415


   The reason for opening #5308 is fixed. Let's retrigger the build with the precompiled curl and see if it gets resolved or not.


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



[GitHub] [apisix] bisakhmondal commented on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-951078571


   CI failure is not related to this PR.
   
   cc @spacewander to retrigger te CIs


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



[GitHub] [apisix] spacewander commented on a change in pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#discussion_r734151391



##########
File path: t/node/grpc_proxy_stream.t
##########
@@ -0,0 +1,266 @@
+#
+# 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';
+
+no_long_string();
+no_root_location();
+no_shuffle();
+add_block_preprocessor(sub {
+    my ($block) = @_;
+    if (!$block->request) {
+        $block->set_value("request", "GET /t");
+    }
+    if (!$block->no_error_log && !$block->error_log) {
+        $block->set_value("no_error_log", "[error]\n[alert]");
+    }
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: Unary API gRPC proxy
+--- http2
+--- apisix_yaml
+routes:
+  -
+    id: 1
+    uris:
+        - /helloworld.Greeter/SayHello
+    methods: [
+        POST
+    ]
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:50051": 1
+      type: roundrobin
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local ngx_pipe = require("ngx.pipe")
+            local proc, err = ngx_pipe.spawn("./build-cache/grpcurl -import-path ./build-cache/proto -proto helloworld.proto -plaintext -d '{\"name\":\"apisix\"}' 127.0.0.1:1984 helloworld.Greeter.SayHello")
+            if not proc then
+                ngx.say(err)
+                return
+            end
+            local data, err = proc:stdout_read_all()
+            if not data then
+                ngx.say(err)
+                return
+            end
+            ngx.say(data:sub(1, -2))
+            return
+        }
+    }
+--- response_body
+{
+  "message": "Hello apisix"
+}
+
+
+
+=== TEST 2: Unary API gRPC proxy with tls
+--- http2
+--- tls

Review comment:
       There is no section called `tls`. To access HTTPS port, use 1994 instead. See https://github.com/apache/apisix/blob/master/docs/en/latest/internal/testing-framework.md#upstream

##########
File path: t/node/grpc_proxy_stream.t
##########
@@ -0,0 +1,266 @@
+#
+# 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';
+
+no_long_string();
+no_root_location();
+no_shuffle();
+add_block_preprocessor(sub {
+    my ($block) = @_;
+    if (!$block->request) {
+        $block->set_value("request", "GET /t");
+    }
+    if (!$block->no_error_log && !$block->error_log) {
+        $block->set_value("no_error_log", "[error]\n[alert]");
+    }
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: Unary API gRPC proxy
+--- http2
+--- apisix_yaml
+routes:
+  -
+    id: 1
+    uris:
+        - /helloworld.Greeter/SayHello
+    methods: [
+        POST
+    ]
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:50051": 1
+      type: roundrobin
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local ngx_pipe = require("ngx.pipe")
+            local proc, err = ngx_pipe.spawn("./build-cache/grpcurl -import-path ./build-cache/proto -proto helloworld.proto -plaintext -d '{\"name\":\"apisix\"}' 127.0.0.1:1984 helloworld.Greeter.SayHello")
+            if not proc then
+                ngx.say(err)
+                return
+            end
+            local data, err = proc:stdout_read_all()
+            if not data then
+                ngx.say(err)
+                return
+            end
+            ngx.say(data:sub(1, -2))
+            return
+        }
+    }
+--- response_body
+{
+  "message": "Hello apisix"
+}
+
+
+
+=== TEST 2: Unary API gRPC proxy with tls
+--- http2
+--- tls
+--- apisix_yaml
+ssl:
+  -
+    id: 1
+    cert: "-----BEGIN CERTIFICATE-----\nMIIEojCCAwqgAwIBAgIJAK253pMhgCkxMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV\nBAYTAkNOMRIwEAYDVQQIDAlHdWFuZ0RvbmcxDzANBgNVBAcMBlpodUhhaTEPMA0G\nA1UECgwGaXJlc3R5MREwDwYDVQQDDAh0ZXN0LmNvbTAgFw0xOTA2MjQyMjE4MDVa\nGA8yMTE5MDUzMTIyMTgwNVowVjELMAkGA1UEBhMCQ04xEjAQBgNVBAgMCUd1YW5n\nRG9uZzEPMA0GA1UEBwwGWmh1SGFpMQ8wDQYDVQQKDAZpcmVzdHkxETAPBgNVBAMM\nCHRlc3QuY29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAyCM0rqJe\ncvgnCfOw4fATotPwk5Ba0gC2YvIrO+gSbQkyxXF5jhZB3W6BkWUWR4oNFLLSqcVb\nVDPitz/Mt46Mo8amuS6zTbQetGnBARzPLtmVhJfoeLj0efMiOepOSZflj9Ob4yKR\n2bGdEFOdHPjm+4ggXU9jMKeLqdVvxll/JiVFBW5smPtW1Oc/BV5terhscJdOgmRr\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JG1NMXWjXQPcwTq3sQVLnAHxZRJmOvx69UmK4QKBwFYXXjeXiU3d\nbcrPfe6qNGjfzK+BkhWznuFUMbuxyZWDYQD5yb6ukUosrj7pmZv3BxKcKCvmONU+\nCHgIXB+hG+R9S2mCcH1qBQoP/RSm+TUzS/Bl2UeuhnFZh2jSZQy3OwryUi6nhF0u\nLDzMI/6aO1ggsI23Ri0Y9ZtqVKczTkxzdQKR9xvoNBUufjimRlS80sJCEB3Qm20S\nwzarryret/7GFW1/3cz+hTj9/d45i25zArr3Pocfpur5mfz3fJO8jg==\n-----END RSA PRIVATE KEY-----\n"
+    sni: test.com
+routes:
+  -
+    id: 1
+    uris:
+        - /helloworld.Greeter/SayHello
+    methods: [
+        POST
+    ]
+    upstream:
+      scheme: grpc
+      nodes:
+        "127.0.0.1:50051": 1
+      type: roundrobin
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local ngx_pipe = require("ngx.pipe")
+            local proc, err = ngx_pipe.spawn("./build-cache/grpcurl -import-path ./build-cache/proto -proto helloworld.proto -insecure -d '{\"name\":\"apisix\"}' test.com:1984 helloworld.Greeter.SayHello")
+            if not proc then
+                ngx.say(err)
+                return
+            end
+            local data, err = proc:stdout_read_all()
+            if not data then
+                ngx.say(err)
+                return
+            end
+            ngx.say(data:sub(1, -2))
+            return
+        }
+    }
+--- response_body
+{
+  "message": "Hello apisix"
+}
+
+
+
+=== TEST 3: Unary API gRPC proxy test [the old way]
+--- http2
+--- apisix_yaml
+routes:
+  -
+    id: 1
+    uris:
+        - /helloworld.Greeter/SayHello
+    methods: [
+        POST
+    ]
+    service_protocol: grpc
+    upstream:
+      nodes:
+        "127.0.0.1:50051": 1
+      type: roundrobin
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local ngx_pipe = require("ngx.pipe")
+            local proc, err = ngx_pipe.spawn("./build-cache/grpcurl -import-path ./build-cache/proto -proto helloworld.proto -plaintext -d '{\"name\":\"apisix\"}' 127.0.0.1:1984 helloworld.Greeter.SayHello")
+            if not proc then
+                ngx.say(err)
+                return
+            end
+            local data, err = proc:stdout_read_all()
+            if not data then
+                ngx.say(err)
+                return
+            end
+            ngx.say(data:sub(1, -2))
+            return
+        }
+    }
+--- response_body
+{
+  "message": "Hello apisix"
+}
+
+
+
+=== TEST 4: Unary API grpcs proxy test
+--- http2
+--- tls
+--- apisix_yaml
+ssl:
+  -
+    id: 1
+    cert: "-----BEGIN CERTIFICATE-----\nMIIEojCCAwqgAwIBAgIJAK253pMhgCkxMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV\nBAYTAkNOMRIwEAYDVQQIDAlHdWFuZ0RvbmcxDzANBgNVBAcMBlpodUhhaTEPMA0G\nA1UECgwGaXJlc3R5MREwDwYDVQQDDAh0ZXN0LmNvbTAgFw0xOTA2MjQyMjE4MDVa\nGA8yMTE5MDUzMTIyMTgwNVowVjELMAkGA1UEBhMCQ04xEjAQBgNVBAgMCUd1YW5n\nRG9uZzEPMA0GA1UEBwwGWmh1SGFpMQ8wDQYDVQQKDAZpcmVzdHkxETAPBgNVBAMM\nCHRlc3QuY29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAyCM0rqJe\ncvgnCfOw4fATotPwk5Ba0gC2YvIrO+gSbQkyxXF5jhZB3W6BkWUWR4oNFLLSqcVb\nVDPitz/Mt46Mo8amuS6zTbQetGnBARzPLtmVhJfoeLj0efMiOepOSZflj9Ob4yKR\n2bGdEFOdHPjm+4ggXU9jMKeLqdVvxll/JiVFBW5smPtW1Oc/BV5terhscJdOgmRr\nabf9xiIis9/qVYfyGn52u9452V0owUuwP7nZ01jt6iMWEGeQU6mwPENgvj1olji2\nWjdG2UwpUVp3jp3l7j1ekQ6mI0F7yI+LeHzfUwiyVt1TmtMWn1ztk6FfLRqwJWR/\nEvm95vnfS3Le4S2ky3XAgn2UnCMyej3wDN6qHR1onpRVeXhrBajbCRDRBMwaNw/1\n/3Uvza8QKK10PzQR6OcQ0xo9psMkd9j9ts/dTu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BUufjimRlS80sJCEB3Qm20S\nwzarryret/7GFW1/3cz+hTj9/d45i25zArr3Pocfpur5mfz3fJO8jg==\n-----END RSA PRIVATE KEY-----\n"
+    sni: test.com
+routes:
+  -
+    id: 1
+    uris:
+        - /helloworld.Greeter/SayHello
+    methods: [
+        POST
+    ]
+    upstream:
+      scheme: grpcs
+      nodes:
+        "127.0.0.1:50052": 1
+      type: roundrobin
+#END
+--- config
+    location /t {
+        content_by_lua_block {
+            local ngx_pipe = require("ngx.pipe")
+            local proc, err = ngx_pipe.spawn("./build-cache/grpcurl -import-path ./build-cache/proto -proto helloworld.proto -insecure -d '{\"name\":\"apisix\"}' test.com:1984 helloworld.Greeter.SayHello")
+            if not proc then
+                ngx.say(err)
+                return
+            end
+            local data, err = proc:stdout_read_all()
+            if not data then
+                ngx.say(err)
+                return
+            end
+            ngx.say(data:sub(1, -2))
+            return
+        }
+    }
+--- response_body
+{
+  "message": "Hello apisix"
+}
+
+
+
+=== TEST 5: Unary API grpcs proxy test with mTLS
+--- http2
+--- https

Review comment:
       There is no section called https.
   To test mTLS, we need to use our custom Nginx. See:
   https://github.com/apache/apisix/blob/2f250d53698b0fa617ea981d2d488ebd756bb655/t/grpc-proxy-test.sh#L97
   https://github.com/apache/apisix/blob/2f250d53698b0fa617ea981d2d488ebd756bb655/t/plugin/gzip.t#L19
   
   We can do this test in a separate t/node/grpc-proxy-mtls.t file.

##########
File path: t/node/grpc_proxy_stream.t
##########
@@ -0,0 +1,266 @@
+#

Review comment:
       Better to name it  t/node/grpc-proxy-unary.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



[GitHub] [apisix] spacewander commented on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949379828


   > 
   > 
   > > It's time to retire the original script.
   > 
   > Hey, would you like to add the `grpc-proxy-stream` tests with this PR or I guess it could be handled in a separate PR too. Do let me know
   
   OK, we can do it in next PR. Does https://github.com/apache/apisix/pull/5308 solve the failure of CentOS 7's CI?


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



[GitHub] [apisix] spacewander commented on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949260256


   We can submit another PR to upgrade curl in the CentOS docker first?


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



[GitHub] [apisix] bisakhmondal commented on a change in pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on a change in pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#discussion_r733164263



##########
File path: t/node/grpc_proxy_stream.t
##########
@@ -0,0 +1,225 @@
+#
+# 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_long_string();
+no_root_location();
+no_shuffle();
+log_level("info");
+
+add_block_preprocessor(sub {
+    my ($block) = @_;
+
+    if (!$block->yaml_config) {
+        my $yaml_config = <<_EOC_;
+apisix:
+    config_center: yaml
+    node_listen:
+        - port: 9080
+          enable_http2: false
+        - port: 9081
+          enable_http2: true
+_EOC_

Review comment:
       @spacewander could you please help me with the appropriate YAML config with a port that forwards the grpc proxy. In reality with this config, I am getting a 401 unauthorized. Even I tried adding `X-API-KEY` but due to the nature of HTTP2 header compression, I am not sure if it is the right way for APISIX or not.
   
   Thanks!




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



[GitHub] [apisix] spacewander commented on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949364269


   It's time to retire the original script.


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



[GitHub] [apisix] bisakhmondal commented on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949368031


   > It's time to retire the original script.
   
   Hey, would you like to add the `grpc-proxy-stream` tests with this PR or I guess it could be handled in a separate PR too. Do let me know


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



[GitHub] [apisix] bisakhmondal edited a comment on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal edited a comment on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949583076


   PS: merging https://github.com/apache/apisix/pull/5316 to test the CIs behaviour. Ideally, this should pass because the required dependency of centos 7 has been added through merging #5316 
   
   # DO NOT MERGE UNTIL
   #5308
   #5316 
   are merged
   
   ps. I'll rebase it once they are merged.


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



[GitHub] [apisix] bisakhmondal commented on pull request #5299: refactor: migrate grpc proxy tests from shell to perl scipts

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #5299:
URL: https://github.com/apache/apisix/pull/5299#issuecomment-949259908


   https://github.com/apache/apisix/runs/3971319753?check_suite_focus=true#step:10:506
   
   CI Centos 7 has an outdated curl version that doesn't support HTTP2. This is the same issue, that I faced the last day.
   @spacewander what should we do now?


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