Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts to run interop-tests on grpc-web Java connector #869

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ services:
image: grpcweb/interop-client
ports:
- "8081:8081"
java-interop-server:
build:
context: ./
dockerfile: ./net/grpc/gateway/docker/java_interop_server/Dockerfile
image: grpcweb/java-interop-server
42 changes: 42 additions & 0 deletions net/grpc/gateway/docker/java_interop_server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2018 Google LLC
#
# Licensed 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
#
# https://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.

FROM maven:3.6.1-jdk-8

RUN apt-get -qq update && apt-get -qq install -y \
unzip

WORKDIR /tmp

RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v3.12.2/\
protoc-3.12.2-linux-x86_64.zip -o protoc.zip && \
unzip -qq protoc.zip && \
cp ./bin/protoc /usr/local/bin/protoc

RUN curl -sSL https://github.com/grpc/grpc-web/releases/download/1.2.0/\
protoc-gen-grpc-web-1.2.0-linux-x86_64 -o /usr/local/bin/protoc-gen-grpc-web && \
chmod +x /usr/local/bin/protoc-gen-grpc-web

WORKDIR /var/www/html/dist

WORKDIR /github/grpc-web

RUN git clone https://github.com/grpc/grpc-web . && \
cd src/connector && \
mvn install && \
cd ../../net/grpc/gateway/examples/grpc-web-java/interop-test-service && \
mvn package

ENTRYPOINT ["java", "-cp", "net/grpc/gateway/examples/grpc-web-java/interop-test-service/target/interop-test-0.1-jar-with-dependencies.jar", "grpcweb.examples.StartServiceAndGrpcwebProxy"]

17 changes: 14 additions & 3 deletions scripts/run_interop_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
# limitations under the License.
set -ex

run_tests () {
docker run --network=host --rm grpcweb/prereqs /bin/bash \
/github/grpc-web/scripts/docker-run-interop-tests.sh
}

SCRIPT_DIR=$(dirname "$0")
REPO_DIR=$(realpath "${SCRIPT_DIR}/..")

Expand All @@ -31,7 +36,7 @@ done


# Build all relevant docker images. They should all build successfully.
docker-compose build common prereqs node-interop-server interop-client
docker-compose build common prereqs node-interop-server interop-client java-interop-server


# Run interop tests
Expand All @@ -40,13 +45,19 @@ pid1=$(docker run -d \
--network=host envoyproxy/envoy:v1.14.1)
pid2=$(docker run -d --network=host grpcweb/node-interop-server)

docker run --network=host --rm grpcweb/prereqs /bin/bash \
/github/grpc-web/scripts/docker-run-interop-tests.sh
run_tests

docker rm -f "$pid1"
docker rm -f "$pid2"


#
# Run interop tests against grpc-web java connector code
#
pid3=$(docker run -d --network=host grpcweb/java-interop-server)
run_tests
docker rm -f "$pid3"

# Clean up
git clean -f -d -x
echo 'Completed'