Skip to content

Commit

Permalink
revert UNIX change. Force push due to line endings
Browse files Browse the repository at this point in the history
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
  • Loading branch information
Sotiris Nanopoulos committed Nov 23, 2020
1 parent e7da1dd commit 6c77c6d
Showing 1 changed file with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,25 @@ mkdir -p "${FIXTURE_DIR}"

DRIVER_DIR="${TEST_SRCDIR}/envoy/test/extensions/filters/network/thrift_proxy/driver"

# On UNIX python supports AF_UNIX socket which are more reliable and efficient for communication
# between the client and the server, so we use it. On Windows, we find a random unused port
# on and let the communication happen via TCP.

SOCKET=""
if [[ "$OSTYPE" == "msys" ]]; then
while
port=$(shuf -n 1 -i 49152-65535)
netstat -atn | grep -q "$port" >> /dev/null
do
continue
done
SOCKET="127.0.0.1:${port}"
else
SOCKET="${TEST_TMPDIR}/fixture.sock"
rm -f "${SOCKET}"
fi

while
port=$(shuf -n 1 -i 49152-65535)
netstat -atn | grep -q "$port" >> /dev/null
do
continue
done


SOCKET="127.0.0.1:${port}"
echo "Using address ${SOCKET}"

SERVICE_FLAGS=("--addr" "${SOCKET}"
"--response" "${MODE}"
"--transport" "${TRANSPORT}"
Expand All @@ -90,17 +97,18 @@ else
fi

# start server
if [[ "$OSTYPE" == "win32" ]]; then
if [[ "$OSTYPE" == "msys" ]]; then
echo "${SERVICE_FLAGS[@]}"
"${DRIVER_DIR}/server.exe" "${SERVICE_FLAGS[@]}" &
else
"${DRIVER_DIR}/server" "${SERVICE_FLAGS[@]}" &
"${DRIVER_DIR}/server" "--unix" "${SERVICE_FLAGS[@]}" &
fi
SERVER_PID="$!"

trap 'kill ${SERVER_PID}' EXIT;

CLIENT_COMMAND=""
if [[ "$OSTYPE" == "win32" ]]; then
if [[ "$OSTYPE" == "msys" ]]; then
CLIENT_COMMAND="${DRIVER_DIR}/client.exe"
else
CLIENT_COMMAND="${DRIVER_DIR}/client"
Expand All @@ -116,4 +124,4 @@ echo "${METHOD}" "$@"
$CLIENT_COMMAND "${SERVICE_FLAGS[@]}" \
--request "${REQUEST_FILE}" \
--response "${RESPONSE_FILE}" \
"${METHOD}" "$@"
"${METHOD}" "$@"

0 comments on commit 6c77c6d

Please sign in to comment.