Skip to content

Commit b2e4bfa

Browse files
committed
Merge matrix feature branch into master.
Features included in this merge: - Added script to build and upload docker image for matrix test. - Added script to create test cases and created go__master testcases based on it. - Created dictionary for runtimes and gRPC releases for supported languages. - Added go 1.7 and 1.8 Dockerfile/templates. See tools/interop_matrix/README.md for details.
1 parent af3cc76 commit b2e4bfa

File tree

15 files changed

+624
-129
lines changed

15 files changed

+624
-129
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
# Copyright 2015, Google Inc.
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are
7+
# met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
# * Redistributions in binary form must reproduce the above
12+
# copyright notice, this list of conditions and the following disclaimer
13+
# in the documentation and/or other materials provided with the
14+
# distribution.
15+
# * Neither the name of Google Inc. nor the names of its
16+
# contributors may be used to endorse or promote products derived from
17+
# this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
#
31+
# Builds Go interop server and client in a base image.
32+
set -e
33+
34+
# Clone just the grpc-go source code without any dependencies.
35+
# We are cloning from a local git repo that contains the right revision
36+
# to test instead of using "go get" to download from Github directly.
37+
git clone --recursive /var/local/jenkins/grpc-go src/google.golang.org/grpc
38+
39+
# Get all gRPC Go dependencies
40+
(cd src/google.golang.org/grpc && make deps && make testdeps)
41+
42+
# copy service account keys if available
43+
cp -r /var/local/jenkins/service_account $HOME || true
44+
45+
# Build the interop client and server
46+
(cd src/google.golang.org/grpc/interop/client && go install)
47+
(cd src/google.golang.org/grpc/interop/server && go install)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
%YAML 1.2
2+
--- |
3+
<%include file="../../go_build_interop.sh.include"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
%YAML 1.2
2+
--- |
3+
<%include file="../../go_build_interop.sh.include"/>

third_party/protobuf

tools/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ container engine, BigQuery etc)
1313

1414
internal_ci: Support for running tests on an internal CI platform.
1515

16+
interop_matrix: Scripts to build, upload, and run gRPC clients in docker with various language/runtimes.
17+
1618
jenkins: Support for running tests on Jenkins.
1719

1820
run_tests: Scripts to run gRPC tests in parallel.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# Copyright 2015, Google Inc.
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are
7+
# met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
# * Redistributions in binary form must reproduce the above
12+
# copyright notice, this list of conditions and the following disclaimer
13+
# in the documentation and/or other materials provided with the
14+
# distribution.
15+
# * Neither the name of Google Inc. nor the names of its
16+
# contributors may be used to endorse or promote products derived from
17+
# this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
#
31+
# Builds Go interop server and client in a base image.
32+
set -e
33+
34+
# Clone just the grpc-go source code without any dependencies.
35+
# We are cloning from a local git repo that contains the right revision
36+
# to test instead of using "go get" to download from Github directly.
37+
git clone --recursive /var/local/jenkins/grpc-go src/google.golang.org/grpc
38+
39+
# Get all gRPC Go dependencies
40+
(cd src/google.golang.org/grpc && make deps && make testdeps)
41+
42+
# copy service account keys if available
43+
cp -r /var/local/jenkins/service_account $HOME || true
44+
45+
# Build the interop client and server
46+
(cd src/google.golang.org/grpc/interop/client && go install)
47+
(cd src/google.golang.org/grpc/interop/server && go install)
48+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# Copyright 2015, Google Inc.
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are
7+
# met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
# * Redistributions in binary form must reproduce the above
12+
# copyright notice, this list of conditions and the following disclaimer
13+
# in the documentation and/or other materials provided with the
14+
# distribution.
15+
# * Neither the name of Google Inc. nor the names of its
16+
# contributors may be used to endorse or promote products derived from
17+
# this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
#
31+
# Builds Go interop server and client in a base image.
32+
set -e
33+
34+
# Clone just the grpc-go source code without any dependencies.
35+
# We are cloning from a local git repo that contains the right revision
36+
# to test instead of using "go get" to download from Github directly.
37+
git clone --recursive /var/local/jenkins/grpc-go src/google.golang.org/grpc
38+
39+
# Get all gRPC Go dependencies
40+
(cd src/google.golang.org/grpc && make deps && make testdeps)
41+
42+
# copy service account keys if available
43+
cp -r /var/local/jenkins/service_account $HOME || true
44+
45+
# Build the interop client and server
46+
(cd src/google.golang.org/grpc/interop/client && go install)
47+
(cd src/google.golang.org/grpc/interop/server && go install)
48+

tools/gcp/utils/gcr_upload.py

-119
This file was deleted.

tools/interop_matrix/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Overview
2+
3+
This directory contains scripts that facilitate building and running gRPC tests for combinations of language/runtimes (known as matrix).
4+
5+
The setup builds gRPC docker images for each language/runtime and upload it to Google Container Registry (GCR). These images, encapsulating gRPC stack
6+
from specific releases/tag, are used to test version compatiblity between gRPC release versions.
7+
8+
## Instructions for creating GCR images
9+
- Edit `./client_matrix.py` to include desired gRPC release.
10+
- Run `tools/interop_matrix/create_matrix_images.py`. Useful options:
11+
- `--git_checkout` enables git checkout grpc release branch/tag.
12+
- `--release` specifies a git release tag. Make sure it is a valid tag in the grpc github rep.
13+
- `--language` specifies a language.
14+
For examle, To build all languages for all gRPC releases across all runtimes, do `tools/interop_matrix/create_matrix_images.py --git_checkout --release=all`.
15+
- Verify the newly created docker images are uploaded to GCR. For example:
16+
- `gcloud beta container images list --repository gcr.io/grpc-testing` shows image repos.
17+
- `gcloud beta container images list-tags gcr.io/grpc-testing/grpc_interop_go1.7` show tags for a image repo.
18+
19+
## Instructions for adding new language/runtimes*
20+
- Create new `Dockerfile.template`, `build_interop.sh.template` for the language/runtime under `template/tools/dockerfile/`.
21+
- Run `tools/buildgen/generate_projects.sh` to create corresponding files under `tools/dockerfile/`.
22+
- Add language/runtimes to `client_matrix.py` following existing language/runtimes examples.
23+
- Run `tools/interop_matrix/create_matrix_images.py` which will build and upload images to GCR. Unless you are also building images for a gRPC release, make sure not to set `--gcr_tag` (the default tag 'master' is used for testing).
24+
25+
*: Please delete your docker images at https://pantheon.corp.google.com/gcr/images/grpc-testing?project=grpc-testing afterwards. Permissions to access GrpcTesting project is required for this step.
26+
27+
## Instructions for creating new test cases
28+
- Create test cases by running `LANG=<lang> [RELEASE=<release>] ./create_testcases.sh`. For example,
29+
- `LANG=go ./create_testcases.sh` will generate `./testcases/go__master`, which is also a functional bash script.
30+
- `LANG=go KEEP_IMAGE=1 ./create_testcases.sh` will generate `./testcases/go__master` and keep the local docker image so it can be invoked simply via `./testcases/go__master`. Note: remove local docker images manually afterwards with `docker rmi <image_id>`.
31+
- Stage and commit the generated test case file `./testcases/<lang>__<release>`.
32+
33+
## Instructions for running test cases against a GCR image
34+
- Run test cases by specifying `docker_image` variable inline with the test case script created above.
35+
For example:
36+
- `docker_image=gcr.io/grpc-testing/grpc_interop_go1.7:master ./testcases/go__master` will run go__master test cases against `go1.7` with gRPC release `master` docker image in GCR.
37+
38+
39+
Note:
40+
- File path starting with `tools/` or `template/` are relative to the grpc repo root dir. File path starting with `./` are relative to current directory (`tools/interop_matrix`).

tools/interop_matrix/client_matrix.py

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env python2.7
2+
# Copyright 2017, Google Inc.
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are
7+
# met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
# * Redistributions in binary form must reproduce the above
12+
# copyright notice, this list of conditions and the following disclaimer
13+
# in the documentation and/or other materials provided with the
14+
# distribution.
15+
# * Neither the name of Google Inc. nor the names of its
16+
# contributors may be used to endorse or promote products derived from
17+
# this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
# Dictionaries used for client matrix testing.
32+
33+
def get_github_repo(lang):
34+
return {
35+
'go': '[email protected]:grpc/grpc-go.git',
36+
'java': '[email protected]:grpc/grpc-java.git',
37+
}.get(lang, '[email protected]:grpc/grpc.git')
38+
39+
# Dictionary of runtimes per language
40+
LANG_RUNTIME_MATRIX = {
41+
'go': ['go1.7', 'go1.8'],
42+
}
43+
44+
# Dictionary of releases per language. For each language, we need to provide
45+
# a tuple of release tag (used as the tag for the GCR image) and also github hash.
46+
LANG_RELEASE_MATRIX = {
47+
'go': ['v1.0.1-GA', 'v1.3.0'],
48+
}

0 commit comments

Comments
 (0)