You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/10/25 06:43:45 UTC

[apisix] branch master updated: ci: test framework requires grpcurl in centos7 ci (#5316)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 5c27f0b  ci: test framework requires grpcurl in centos7 ci (#5316)
5c27f0b is described below

commit 5c27f0b3d488f1959374aed4eeac07bace6eb83e
Author: Bisakh <bi...@gmail.com>
AuthorDate: Mon Oct 25 12:13:38 2021 +0530

    ci: test framework requires grpcurl in centos7 ci (#5316)
    
    Co-authored-by: 罗泽轩 <sp...@gmail.com>
---
 ci/centos7-ci.sh                    |  3 +++
 ci/common.sh                        |  7 +++++++
 ci/linux_openresty_common_runner.sh |  7 ++-----
 docs/en/latest/grpc-proxy.md        |  2 ++
 docs/zh/latest/grpc-proxy.md        |  2 ++
 t/grpc-proxy-test.sh                | 10 +++++-----
 6 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/ci/centos7-ci.sh b/ci/centos7-ci.sh
index 9b6a48d..4b39a10 100755
--- a/ci/centos7-ci.sh
+++ b/ci/centos7-ci.sh
@@ -59,6 +59,9 @@ install_dependencies() {
     # wait for grpc_server_example to fully start
     sleep 3
 
+    # installing grpcurl
+    install_grpcurl
+
     # install dependencies
     git clone https://github.com/iresty/test-nginx.git test-nginx
     make deps
diff --git a/ci/common.sh b/ci/common.sh
index bf06c49..0aae070 100644
--- a/ci/common.sh
+++ b/ci/common.sh
@@ -31,4 +31,11 @@ create_lua_deps() {
     # luarocks install luacov-coveralls --tree=deps --local > build.log 2>&1 || (cat build.log && exit 1)
 }
 
+install_grpcurl () {
+    # For more versions, visit https://github.com/fullstorydev/grpcurl/releases
+    GRPCURL_VERSION="1.8.5"
+    wget https://github.com/fullstorydev/grpcurl/releases/download/v${GRPCURL_VERSION}/grpcurl_${GRPCURL_VERSION}_linux_x86_64.tar.gz
+    tar -xvf grpcurl_${GRPCURL_VERSION}_linux_x86_64.tar.gz -C /usr/local/bin
+}
+
 GRPC_SERVER_EXAMPLE_VER=20210819
diff --git a/ci/linux_openresty_common_runner.sh b/ci/linux_openresty_common_runner.sh
index 0e6e9ff..7649f6a 100755
--- a/ci/linux_openresty_common_runner.sh
+++ b/ci/linux_openresty_common_runner.sh
@@ -57,11 +57,8 @@ do_install() {
         touch build-cache/grpc_server_example_"$GRPC_SERVER_EXAMPLE_VER"
     fi
 
-    if [ ! -f "build-cache/grpcurl" ]; then
-        wget https://github.com/api7/grpcurl/releases/download/20200314/grpcurl-amd64.tar.gz
-        tar -xvf grpcurl-amd64.tar.gz
-        mv grpcurl build-cache/
-    fi
+    # installing grpcurl
+    install_grpcurl
 }
 
 script() {
diff --git a/docs/en/latest/grpc-proxy.md b/docs/en/latest/grpc-proxy.md
index dd71f03..3ec23bb 100644
--- a/docs/en/latest/grpc-proxy.md
+++ b/docs/en/latest/grpc-proxy.md
@@ -66,6 +66,8 @@ $ grpcurl -insecure -import-path /pathtoprotos  -proto helloworld.proto  -d '{"n
 }
 ```
 
+> grpcurl is a CLI tool, similar to curl, that acts as a gRPC client and lets you interact with a gRPC server. For installation, please check out the official [documentation](https://github.com/fullstorydev/grpcurl#installation).
+
 This means that the proxying is working.
 
 #### testing HTTP/2 with plaintext
diff --git a/docs/zh/latest/grpc-proxy.md b/docs/zh/latest/grpc-proxy.md
index e57a652..ebd0165 100644
--- a/docs/zh/latest/grpc-proxy.md
+++ b/docs/zh/latest/grpc-proxy.md
@@ -66,6 +66,8 @@ grpcurl -insecure -import-path /pathtoprotos  -proto helloworld.proto  \
 }
 ```
 
+> grpcurl 是一个 CLI 工具,类似于 curl,充当 gRPC 客户端并让您与 gRPC 服务器进行交互。安装方式请查看官方[文档](https://github.com/fullstorydev/grpcurl#installation)
+
 这表示已成功代理。
 
 ### 测试纯文本的 HTTP/2
diff --git a/t/grpc-proxy-test.sh b/t/grpc-proxy-test.sh
index b6574cd..c5e6584 100755
--- a/t/grpc-proxy-test.sh
+++ b/t/grpc-proxy-test.sh
@@ -57,10 +57,10 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 
 # test grpc proxy with plaintext
-./build-cache/grpcurl -plaintext -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' 127.0.0.1:9081 helloworld.Greeter.SayHello | grep 'Hello apisix'
+grpcurl -plaintext -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' 127.0.0.1:9081 helloworld.Greeter.SayHello | grep 'Hello apisix'
 
 # test grpc proxy with ssl
-./build-cache/grpcurl -insecure -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' test.com:9443 helloworld.Greeter.SayHello | grep 'Hello apisix'
+grpcurl -insecure -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' test.com:9443 helloworld.Greeter.SayHello | grep 'Hello apisix'
 
 # the old way
 curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
@@ -76,7 +76,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
     }
 }'
 
-./build-cache/grpcurl -insecure -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' test.com:9443 helloworld.Greeter.SayHello | grep 'Hello apisix'
+grpcurl -insecure -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' test.com:9443 helloworld.Greeter.SayHello | grep 'Hello apisix'
 
 #test grpcs proxy
 curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
@@ -92,7 +92,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
     }
 }'
 
-./build-cache/grpcurl -insecure -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' test.com:9443 helloworld.Greeter.SayHello | grep 'Hello apisix'
+grpcurl -insecure -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' test.com:9443 helloworld.Greeter.SayHello | grep 'Hello apisix'
 
 if ! openresty -V 2>&1 | grep "apisix-nginx-module"; then
     echo "skip vanilla OpenResty"
@@ -118,5 +118,5 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
     }
 }'
 
-./build-cache/grpcurl -insecure -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' test.com:9443 helloworld.Greeter.SayHello | grep 'Hello apisix'
+grpcurl -insecure -import-path ./build-cache/proto -proto helloworld.proto -d '{"name":"apisix"}' test.com:9443 helloworld.Greeter.SayHello | grep 'Hello apisix'
 clean_up