From 37a7fae48cd09fd9622cb5c873d93775353b31d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=B3=BD=E8=BD=A9?= Date: Wed, 10 Feb 2021 00:50:58 +0800 Subject: [PATCH] test: detect if grpc_server_example starts (#3566) Signed-off-by: spacewander --- .travis/linux_openresty_common_runner.sh | 2 +- t/grpc-proxy-test.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.travis/linux_openresty_common_runner.sh b/.travis/linux_openresty_common_runner.sh index 55d42dad15fd..32d2c3efab98 100755 --- a/.travis/linux_openresty_common_runner.sh +++ b/.travis/linux_openresty_common_runner.sh @@ -131,7 +131,7 @@ script() { sleep 1 cat logs/error.log - sh ./t/grpc-proxy-test.sh + ./t/grpc-proxy-test.sh sleep 1 ./bin/apisix stop diff --git a/t/grpc-proxy-test.sh b/t/grpc-proxy-test.sh index 7ffa9650419d..3c7e0551a443 100755 --- a/t/grpc-proxy-test.sh +++ b/t/grpc-proxy-test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,6 +18,16 @@ set -ex +# ensure grpc server example is already started +for (( i = 0; i <= 100; i++ )); do + if [[ "$i" -eq 100 ]]; then + echo "failed to start grpc_server_example in time" + exit 1 + fi + nc -zv 127.0.0.1 50051 && break + sleep 1 +done + #set ssl curl http://127.0.0.1:9080/apisix/admin/ssl/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' {