Skip to content
Snippets Groups Projects
Commit c3c3a8f0 authored by murgatroid99's avatar murgatroid99
Browse files

Added docker files for node interop tests

parent c5e9018d
No related branches found
No related tags found
No related merge requests found
# Dockerfile for gRPC Node
FROM grpc/node_base
# Update the C libary
RUN cd /var/local/git/grpc \
&& git pull --recurse-submodules \
&& git submodule update --init --recursive
# Install the C core.
RUN make install_c -C /var/local/git/grpc
RUN cd /var/local/git/grpc/src/node && npm install && node-gyp rebuild
CMD ["/usr/bin/nodejs", "/var/local/git/grpc/src/node/interop/interop_server.js", "--use_tls=true", "--port 8040"]
\ No newline at end of file
# Base Dockerfile for gRPC Node.
#
# Includes Node installation dependencies
FROM grpc/base
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get update && apt-get install -y nodejs
RUN npm install -g node-gyp
# Get the source from GitHub, this gets the protobuf library as well
RUN git clone git@github.com:google/grpc.git /var/local/git/grpc
RUN cd /var/local/git/grpc && \
git pull --recurse-submodules && \
git submodule update --init --recursive
# Build the C core
RUN make static_c shared_c -j12 -C /var/local/git/grpc
# Define the default command.
CMD ["bash"]
\ No newline at end of file
...@@ -350,7 +350,7 @@ grpc_interop_test_args() { ...@@ -350,7 +350,7 @@ grpc_interop_test_args() {
[[ -n $1 ]] && { # client_type [[ -n $1 ]] && { # client_type
case $1 in case $1 in
cxx|go|java|nodejs|php|python|ruby) cxx|go|java|node|php|python|ruby)
grpc_gen_test_cmd="grpc_interop_gen_$1_cmd" grpc_gen_test_cmd="grpc_interop_gen_$1_cmd"
declare -F $grpc_gen_test_cmd >> /dev/null || { declare -F $grpc_gen_test_cmd >> /dev/null || {
echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2
...@@ -381,7 +381,7 @@ grpc_interop_test_args() { ...@@ -381,7 +381,7 @@ grpc_interop_test_args() {
cxx) grpc_port=8010 ;; cxx) grpc_port=8010 ;;
go) grpc_port=8020 ;; go) grpc_port=8020 ;;
java) grpc_port=8030 ;; java) grpc_port=8030 ;;
nodejs) grpc_port=8040 ;; node) grpc_port=8040 ;;
python) grpc_port=8050 ;; python) grpc_port=8050 ;;
ruby) grpc_port=8060 ;; ruby) grpc_port=8060 ;;
*) echo "bad server_type: $1" 1>&2; return 1 ;; *) echo "bad server_type: $1" 1>&2; return 1 ;;
...@@ -421,7 +421,7 @@ grpc_cloud_prod_test_args() { ...@@ -421,7 +421,7 @@ grpc_cloud_prod_test_args() {
[[ -n $1 ]] && { # client_type [[ -n $1 ]] && { # client_type
case $1 in case $1 in
cxx|go|java|nodejs|php|python|ruby) cxx|go|java|node|php|python|ruby)
grpc_gen_test_cmd="grpc_cloud_prod_gen_$1_cmd" grpc_gen_test_cmd="grpc_cloud_prod_gen_$1_cmd"
declare -F $grpc_gen_test_cmd >> /dev/null || { declare -F $grpc_gen_test_cmd >> /dev/null || {
echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2
...@@ -555,7 +555,7 @@ grpc_launch_server_args() { ...@@ -555,7 +555,7 @@ grpc_launch_server_args() {
cxx) grpc_port=8010 ;; cxx) grpc_port=8010 ;;
go) grpc_port=8020 ;; go) grpc_port=8020 ;;
java) grpc_port=8030 ;; java) grpc_port=8030 ;;
nodejs) grpc_port=8040 ;; node) grpc_port=8040 ;;
python) grpc_port=8050 ;; python) grpc_port=8050 ;;
ruby) grpc_port=8060 ;; ruby) grpc_port=8060 ;;
*) echo "bad server_type: $1" 1>&2; return 1 ;; *) echo "bad server_type: $1" 1>&2; return 1 ;;
...@@ -627,7 +627,7 @@ grpc_launch_server() { ...@@ -627,7 +627,7 @@ grpc_launch_server() {
# cxx: 8010 # cxx: 8010
# go: 8020 # go: 8020
# java: 8030 # java: 8030
# nodejs: 8040 # node: 8040
# python: 8050 # python: 8050
# ruby: 8060 # ruby: 8060
# #
...@@ -813,6 +813,13 @@ grpc_interop_gen_cxx_cmd() { ...@@ -813,6 +813,13 @@ grpc_interop_gen_cxx_cmd() {
echo $the_cmd echo $the_cmd
} }
grpc_interop_gen_node_cmd() {
local cmd_prefix="sudo docker run grpc/node";
local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true";
local the_cmd="$cmd_prefix $test_script $@";
echo $the_cmd
}
# constructs the full dockerized cpp interop test cmd. # constructs the full dockerized cpp interop test cmd.
# #
# #
...@@ -827,4 +834,4 @@ grpc_cloud_prod_gen_cxx_cmd() { ...@@ -827,4 +834,4 @@ grpc_cloud_prod_gen_cxx_cmd() {
echo $the_cmd echo $the_cmd
} }
# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python|cxx|nodejs # TODO(grpc-team): add grpc_interop_gen_python_cmd
...@@ -367,7 +367,7 @@ grpc_docker_launch_registry() { ...@@ -367,7 +367,7 @@ grpc_docker_launch_registry() {
grpc_docker_pull_known() { grpc_docker_pull_known() {
local addr=$1 local addr=$1
[[ -n $addr ]] || addr="0.0.0.0:5000" [[ -n $addr ]] || addr="0.0.0.0:5000"
local known="base cxx php_base php ruby_base ruby java_base java go" local known="base cxx php_base php ruby_base ruby java_base java go node_base node"
echo "... pulling docker images for '$known'" echo "... pulling docker images for '$known'"
for i in $known for i in $known
do do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment