From 51750dc7d1cb08a3d2fa3b3bd90b48e4e65c7fc8 Mon Sep 17 00:00:00 2001
From: Yong Ni <yongni@google.com>
Date: Fri, 14 Jul 2017 11:30:56 -0700
Subject: [PATCH] Added c++ to interop_matrix.  Per earlier conversation,
 interop_matrix will not run against different compiler/toolchains so we are
 not addding _<runtime> to c++. This simplifies our setup and reduces
 unnecesary complexities in the infrastructure.

---
 tools/interop_matrix/client_matrix.py            |  3 +++
 tools/interop_matrix/run_interop_matrix_tests.py |  3 ++-
 tools/interop_matrix/testcases/cxx__master       | 11 +++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100755 tools/interop_matrix/testcases/cxx__master

diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py
index 34becf9bb7..4394e32c08 100644
--- a/tools/interop_matrix/client_matrix.py
+++ b/tools/interop_matrix/client_matrix.py
@@ -19,10 +19,12 @@ def get_github_repo(lang):
   return {
       'go': 'git@github.com:grpc/grpc-go.git',
       'java': 'git@github.com:grpc/grpc-java.git',
+      # all other languages use the grpc.git repo.
   }.get(lang, 'git@github.com:grpc/grpc.git')
 
 # Dictionary of runtimes per language
 LANG_RUNTIME_MATRIX = {
+    'cxx': ['cxx'],             # This is actually debian8.
     'go': ['go1.7', 'go1.8'],
     'java': ['java_oracle8'],
 }
@@ -30,6 +32,7 @@ LANG_RUNTIME_MATRIX = {
 # Dictionary of releases per language.  For each language, we need to provide
 # a tuple of release tag (used as the tag for the GCR image) and also github hash.
 LANG_RELEASE_MATRIX = {
+    'cxx': ['v1.0.1', 'v1.1.2'],
     'go': ['v1.0.1-GA', 'v1.3.0'],
     'java': ['v1.0.3', 'v1.1.2'],
 }
diff --git a/tools/interop_matrix/run_interop_matrix_tests.py b/tools/interop_matrix/run_interop_matrix_tests.py
index b1b95ed679..28126ddf5c 100755
--- a/tools/interop_matrix/run_interop_matrix_tests.py
+++ b/tools/interop_matrix/run_interop_matrix_tests.py
@@ -125,7 +125,6 @@ def find_test_cases(lang, release):
       # Only line start with 'docker run' are test cases.
       for line in f.readlines():
         if line.startswith('docker run'):
-          line = line.replace('docker run', 'gcloud docker -- run')
           m = re.search('--test_case=(.*)"', line)
           shortname = m.group(1) if m else 'unknown_test'
           spec = jobset.JobSpec(cmdline=line,
@@ -152,6 +151,8 @@ def run_tests_for_lang(lang, runtime, images):
   for image_tuple in images:
     release, image = image_tuple
     jobset.message('START', 'Testing %s' % image, do_newline=True)
+    # Download the docker image before running each test case.
+    subprocess.check_call(['gcloud', 'docker', '--', 'pull', image])
     _docker_images_cleanup.append(image)
     job_spec_list = find_test_cases(lang,release)
     num_failures, resultset = jobset.run(job_spec_list,
diff --git a/tools/interop_matrix/testcases/cxx__master b/tools/interop_matrix/testcases/cxx__master
new file mode 100755
index 0000000000..ccd2859530
--- /dev/null
+++ b/tools/interop_matrix/testcases/cxx__master
@@ -0,0 +1,11 @@
+#!/bin/bash
+echo "Testing ${docker_image:=grpc_interop_cxx:1423f288-ac00-4f3a-9885-771258eecae3}"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=large_unary"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_unary"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=ping_pong"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=empty_stream"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=client_streaming"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=server_streaming"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_begin"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=cancel_after_first_response"
+docker run -i --rm=true -w /var/local/git/grpc --net=host $docker_image bash -c "bins/opt/interop_client --server_host=216.239.32.254 --server_host_override=grpc-test.sandbox.googleapis.com --server_port=443 --use_tls=true --test_case=timeout_on_sleeping_server"
-- 
GitLab