aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-09-15 12:44:35 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-09-28 15:00:31 -0700
commit320bd614994a04dd36d829ecfe498584b3bb6872 (patch)
treee00b7dfb7db96d7dd5d5e7f9a52669d99dc00552 /tools
parent96bcf021adfeeeab813578cdef5dbe3e7b8b8848 (diff)
simplify running of interop tests on jenkins
Diffstat (limited to 'tools')
-rwxr-xr-xtools/jenkins/docker_run_interop_tests.sh82
-rwxr-xr-xtools/jenkins/docker_run_tests.sh1
-rwxr-xr-xtools/jenkins/run_jenkins.sh1
-rwxr-xr-xtools/jenkins/run_local.sh59
-rwxr-xr-xtools/run_tests/run_interop_test.sh (renamed from tools/run_tests/run_interops_test.sh)20
-rwxr-xr-xtools/run_tests/run_interop_tests.py78
-rwxr-xr-xtools/run_tests/run_interops.py37
-rwxr-xr-xtools/run_tests/run_interops_build.sh75
8 files changed, 233 insertions, 120 deletions
diff --git a/tools/jenkins/docker_run_interop_tests.sh b/tools/jenkins/docker_run_interop_tests.sh
new file mode 100755
index 0000000000..bd6fa4424e
--- /dev/null
+++ b/tools/jenkins/docker_run_interop_tests.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+# Copyright 2015, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# This script is invoked by run_jekins.sh. It contains the test logic
+# that should run inside a docker container.
+set -e
+
+mkdir -p /var/local/git
+git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc
+
+cd /var/local/git/grpc
+nvm use 0.12
+rvm use ruby-2.1
+
+# TODO(jtattermusch): use cleaner way to install root certs
+mkdir -p /usr/local/share/grpc
+cp etc/roots.pem /usr/local/share/grpc/
+
+# build C++ interop client & server
+make interop_client interop_server
+
+# build C# interop client & server
+make install_grpc_csharp_ext
+(cd src/csharp && mono /var/local/NuGet.exe restore Grpc.sln)
+(cd src/csharp && xbuild Grpc.sln)
+
+# build Node interop client & server
+npm install -g node-gyp
+make install_c -C /var/local/git/grpc
+(cd src/node && npm install && node-gyp rebuild)
+
+# build Ruby interop client and server
+(cd src/ruby && gem update bundler && bundle && rake compile:grpc)
+
+# TODO(jtattermusch): add python
+
+# build PHP interop client
+# TODO(jtattermusch): make php work
+# TODO(jtattermusch): prerequisites should be installed sooner than here.
+# Install composer
+#curl -sS https://getcomposer.org/installer | php
+#mv composer.phar /usr/local/bin/composer
+# Download the patched PHP protobuf so that PHP gRPC clients can be generated
+# from proto3 schemas.
+#git clone https://github.com/stanley-cheung/Protobuf-PHP.git /var/local/git/protobuf-php
+#(cd src/php/ext/grpc && phpize && ./configure && make)
+#rvm all do gem install ronn rake
+#(cd /var/local/git/protobuf-php \
+# && rvm all do rake pear:package version=1.0 \
+# && pear install Protobuf-1.0.tgz)
+#(cd src/php && composer install)
+#(cd src/php && protoc-gen-php -i tests/interop/ -o tests/interop/ tests/interop/test.proto)
+
+# run the cloud-to-prod interop tests
+tools/run_tests/run_interop_tests.py -l $language
diff --git a/tools/jenkins/docker_run_tests.sh b/tools/jenkins/docker_run_tests.sh
index 781bff26b9..7877ad2459 100755
--- a/tools/jenkins/docker_run_tests.sh
+++ b/tools/jenkins/docker_run_tests.sh
@@ -30,6 +30,7 @@
#
# This script is invoked by build_docker_and_run_tests.py inside a docker
# container. You should never need to call this script on your own.
+
set -e
export CONFIG=$config
diff --git a/tools/jenkins/run_jenkins.sh b/tools/jenkins/run_jenkins.sh
index c4a01a7d66..66364b3093 100755
--- a/tools/jenkins/run_jenkins.sh
+++ b/tools/jenkins/run_jenkins.sh
@@ -59,6 +59,7 @@ then
elif [ "$platform" == "interop" ]
then
python tools/run_tests/run_interops.py --language=$language $@
+
elif [ "$platform" == "windows" ]
then
echo "building $language on Windows"
diff --git a/tools/jenkins/run_local.sh b/tools/jenkins/run_local.sh
new file mode 100755
index 0000000000..f9d8d26e9a
--- /dev/null
+++ b/tools/jenkins/run_local.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Copyright 2015, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# This script can be used to run dockerized tests that normally run
+# on Jenkins on your local machine using the working copy that
+# is currently checked out locally.
+
+# IMPORTANT: The changes to be tested need to be committed locally,
+# otherwise they won't be cloned inside the docker container.
+set -e
+
+cd `dirname $0`/../..
+
+#TODO(jtattermusch): provide way to tunnel run_tests cmdline options to run_tests.
+#TODO(jtattermusch): provide way to grab the docker image built by run_jenkins
+
+# config: opt or dbg
+export config=opt
+
+# platform:
+# -- use linux to run tests under docker
+# -- use interop to run dockerized interop tests
+export platform=interop
+
+# language: one of languages supported by run_tests.py
+export language=all
+
+# architecture
+export arch=`uname -m`
+
+# test run configuration is done through environment variables above
+tools/jenkins/run_jenkins.sh
diff --git a/tools/run_tests/run_interops_test.sh b/tools/run_tests/run_interop_test.sh
index 9be253af46..255760ba84 100755
--- a/tools/run_tests/run_interops_test.sh
+++ b/tools/run_tests/run_interop_test.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright 2015, Google Inc.
# All rights reserved.
@@ -32,23 +32,27 @@
language=$1
test_case=$2
+# change dir gRPC repo root
+cd $(dirname $0)/../..
+
set -e
if [ "$language" = "c++" ]
then
- sudo docker run grpc/cxx /var/local/git/grpc/bins/opt/interop_client --enable_ssl --use_prod_roots --server_host_override=grpc-test.sandbox.google.com --server_host=grpc-test.sandbox.google.com --server_port=443 --test_case=$test_case
+ bins/opt/interop_client --enable_ssl --use_prod_roots --server_host_override=grpc-test.sandbox.google.com --server_host=grpc-test.sandbox.google.com --server_port=443 --test_case=$test_case
elif [ "$language" = "node" ]
then
- sudo docker run grpc/node /usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true --use_test_ca=true --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com --test_case=$test_case
+ SSL_CERT_FILE=/usr/local/share/grpc/roots.pem node src/node/interop/interop_client.js --use_tls=true --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com --test_case=$test_case
elif [ "$language" = "ruby" ]
then
- cmd_prefix="SSL_CERT_FILE=/cacerts/roots.pem ruby /var/local/git/grpc/src/ruby/bin/interop/interop_client.rb --use_tls --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com "
- cmd="$cmd_prefix --test_case=$test_case"
- sudo docker run grpc/ruby bin/bash -l -c '$cmd'
+ SSL_CERT_FILE=/usr/local/share/grpc/roots.pem ruby src/ruby/bin/interop/interop_client.rb --use_tls --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com --test_case=$test_case
+elif [ "$language" = "csharp" ]
+then
+ (cd src/csharp/Grpc.IntegrationTesting.Client/bin/Debug && SSL_CERT_FILE=/usr/local/share/grpc/roots.pem mono Grpc.IntegrationTesting.Client.exe --use_tls --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com --test_case=$test_case)
elif [ "$language" = "php" ]
then
- sudo docker run -e SSL_CERT_FILE=/cacerts/roots.pem grpc/php /var/local/git/grpc/src/php/bin/interop_client.sh --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com --test_case=$test_case
+ SSL_CERT_FILE=/usr/local/share/grpc/roots.pem src/php/bin/interop_client.sh --server_port=443 --server_host=grpc-test.sandbox.google.com --server_host_override=grpc-test.sandbox.google.com --test_case=$test_case
else
- echo "interop testss not added for $language"
+ echo "interop tests not added for $language"
exit 1
fi
diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py
new file mode 100755
index 0000000000..24410778dc
--- /dev/null
+++ b/tools/run_tests/run_interop_tests.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+# Copyright 2015, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Run interop (cross-language) tests in parallel."""
+
+import argparse
+import itertools
+import xml.etree.cElementTree as ET
+import jobset
+
+# TODO(jtattermusch): add php and python once we get them working
+_LANGUAGES = ['c++', 'node', 'csharp', 'ruby']
+
+# TODO(jtattermusch): add empty_stream once C++ start supporting it.
+# TODO(jtattermusch): add support for auth tests.
+_TEST_CASES = ['large_unary', 'empty_unary', 'ping_pong',
+ 'client_streaming', 'server_streaming',
+ 'cancel_after_begin', 'cancel_after_first_response',
+ 'timeout_on_sleeping_server']
+
+argp = argparse.ArgumentParser(description='Run interop tests.')
+argp.add_argument('-l', '--language',
+ choices=['all'] + sorted(_LANGUAGES),
+ nargs='+',
+ default=['all'])
+args = argp.parse_args()
+
+languages = [l for l in itertools.chain.from_iterable(
+ iter(_LANGUAGES) if x == 'all' else [x]
+ for x in args.language)]
+
+jobs = []
+jobNumber = 0
+for language in languages:
+ for test in _TEST_CASES:
+ test_job = jobset.JobSpec(
+ cmdline=['tools/run_tests/run_interop_test.sh', '%s' % language, '%s' % test],
+ shortname="cloud_to_prod:%s:%s" % (language, test),
+ timeout_seconds=60)
+ jobs.append(test_job)
+ jobNumber+=1
+
+root = ET.Element('testsuites')
+testsuite = ET.SubElement(root, 'testsuite', id='1', package='grpc', name='tests')
+
+jobset.run(jobs, maxjobs=jobNumber, xml_report=testsuite)
+
+tree = ET.ElementTree(root)
+tree.write('report.xml', encoding='UTF-8')
+
+
diff --git a/tools/run_tests/run_interops.py b/tools/run_tests/run_interops.py
deleted file mode 100755
index 17083975d8..0000000000
--- a/tools/run_tests/run_interops.py
+++ /dev/null
@@ -1,37 +0,0 @@
-import argparse
-import xml.etree.cElementTree as ET
-import jobset
-
-argp = argparse.ArgumentParser(description='Run interop tests.')
-argp.add_argument('-l', '--language',
- default='c++')
-args = argp.parse_args()
-
-# build job
-build_job = jobset.JobSpec(cmdline=['tools/run_tests/run_interops_build.sh', '%s' % args.language],
- shortname='build',
- timeout_seconds=30*60)
-
-# test jobs, each test is a separate job to run in parallel
-_TESTS = ['large_unary', 'empty_unary', 'ping_pong', 'client_streaming', 'server_streaming']
-jobs = []
-jobNumber = 0
-for test in _TESTS:
- test_job = jobset.JobSpec(
- cmdline=['tools/run_tests/run_interops_test.sh', '%s' % args.language, '%s' % test],
- shortname=test,
- timeout_seconds=15*60)
- jobs.append(test_job)
- jobNumber+=1
-
-root = ET.Element('testsuites')
-testsuite = ET.SubElement(root, 'testsuite', id='1', package='grpc', name='tests')
-
-# always do the build of docker first, and then all the tests can run in parallel
-jobset.run([build_job], maxjobs=1, xml_report=testsuite)
-jobset.run(jobs, maxjobs=jobNumber, xml_report=testsuite)
-
-tree = ET.ElementTree(root)
-tree.write('report.xml', encoding='UTF-8')
-
-
diff --git a/tools/run_tests/run_interops_build.sh b/tools/run_tests/run_interops_build.sh
deleted file mode 100755
index ff1a26cf89..0000000000
--- a/tools/run_tests/run_interops_build.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh
-
-# Copyright 2015, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-language=$1
-
-set -e
-
-#clean up any old docker files and start mirroring repository if not started already
-sudo docker rmi -f grpc/cxx || true
-sudo docker rmi -f grpc/base || true
-sudo docker rmi -f 0.0.0.0:5000/grpc/base || true
-sudo docker run -d -e GCS_BUCKET=docker-interop-images -e STORAGE_PATH=/admin/docker_images -p 5000:5000 google/docker-registry || true
-
-#prepare building by pulling down base images and necessary files
-sudo docker pull 0.0.0.0:5000/grpc/base
-sudo docker tag -f 0.0.0.0:5000/grpc/base grpc/base
-
-if [ "$language" = "c++" ]
-then
- gsutil cp -R gs://docker-interop-images/admin/service_account tools/dockerfile/grpc_cxx
- gsutil cp -R gs://docker-interop-images/admin/cacerts tools/dockerfile/grpc_cxx
- sudo docker build --no-cache -t grpc/cxx tools/dockerfile/grpc_cxx
-elif [ "$language" = "node" ]
-then
- sudo docker pull 0.0.0.0:5000/grpc/node_base
- sudo docker tag -f 0.0.0.0:5000/grpc/node_base grpc/node_base
- gsutil cp -R gs://docker-interop-images/admin/service_account tools/dockerfile/grpc_node
- gsutil cp -R gs://docker-interop-images/admin/cacerts tools/dockerfile/grpc_node
- sudo docker build --no-cache -t grpc/node tools/dockerfile/grpc_node
-elif [ "$language" = "ruby" ]
-then
- sudo docker pull 0.0.0.0:5000/grpc/ruby_base
- sudo docker tag -f 0.0.0.0:5000/grpc/ruby_base grpc/ruby_base
- gsutil cp -R gs://docker-interop-images/admin/service_account tools/dockerfile/grpc_ruby
- gsutil cp -R gs://docker-interop-images/admin/cacerts tools/dockerfile/grpc_ruby
- sudo docker build --no-cache -t grpc/ruby tools/dockerfile/grpc_ruby
-elif [ "$language" = "php" ]
-then
- sudo docker pull 0.0.0.0:5000/grpc/php_base
- sudo docker tag -f 0.0.0.0:5000/grpc/php_base grpc/php_base
- gsutil cp -R gs://docker-interop-images/admin/service_account tools/dockerfile/grpc_php
- gsutil cp -R gs://docker-interop-images/admin/cacerts tools/dockerfile/grpc_php
- sudo docker build --no-cache -t grpc/php tools/dockerfile/grpc_php
-else
- echo "interop testss not added for $language"
- exit 1
-fi