Files
tonic/interop/test.sh
T
Juan AlvarezandGitHub ca8e597e95 fix(interop) fix failing interop test with go client (#442)
* fix failing interop test

* do not run go client when --use_tls is set
2020-08-31 10:23:12 -05:00

68 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eu
set -o pipefail
set -x
echo "Running for OS: ${OSTYPE}"
case "$OSTYPE" in
darwin*) OS="darwin"; EXT="" ;;
linux*) OS="linux"; EXT="" ;;
msys*) OS="windows"; EXT=".exe" ;;
*) exit 2 ;;
esac
ARG="${1:-""}"
(cd interop && cargo build --bins)
SERVER="interop/bin/server_${OS}_amd64${EXT}"
# TLS_CA="interop/data/ca.pem"
TLS_CRT="interop/data/server1.pem"
TLS_KEY="interop/data/server1.key"
# run the test server
./"${SERVER}" ${ARG} --tls_cert_file $TLS_CRT --tls_key_file $TLS_KEY &
SERVER_PID=$!
echo ":; started grpc-go test server."
# trap exits to make sure we kill the server process when the script exits,
# regardless of why (errors, SIGTERM, etc).
trap 'echo ":; killing test server"; kill ${SERVER_PID};' EXIT
sleep 1
./target/debug/client \
--test_case=empty_unary,large_unary,client_streaming,server_streaming,ping_pong,\
empty_stream,status_code_and_message,special_status_message,unimplemented_method,\
unimplemented_service,custom_metadata ${ARG}
echo ":; killing test server"; kill ${SERVER_PID};
# run the test server
./target/debug/server ${ARG} &
SERVER_PID=$!
echo ":; started tonic test server."
# trap exits to make sure we kill the server process when the script exits,
# regardless of why (errors, SIGTERM, etc).
trap 'echo ":; killing test server"; kill ${SERVER_PID};' EXIT
sleep 1
./target/debug/client \
--test_case=empty_unary,large_unary,client_streaming,server_streaming,ping_pong,\
empty_stream,status_code_and_message,special_status_message,unimplemented_method,\
unimplemented_service,custom_metadata ${ARG}
if [ -z "${ARG}" ]; then
# TODO: run all other test cases w/wo tls
GO_CLIENT="interop/bin/client_${OS}_amd64${EXT}"
$GO_CLIENT --test_case="status_code_and_message"
$GO_CLIENT --test_case="custom_metadata"
fi