Use as much template as possible & fix some wording

pull/21714/head
Lidi Zheng 5 years ago
parent acbc36b281
commit 3e2d5da7a2
  1. 6
      src/python/grpcio_tests/commands.py
  2. 3
      templates/tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh.template
  3. 20
      templates/tools/dockerfile/interoptest/grpc_interop_pythonasyncio/Dockerfile.template
  4. 3
      templates/tools/dockerfile/interoptest/grpc_interop_pythonasyncio/build_interop.sh.template
  5. 32
      templates/tools/dockerfile/python_build_interop.sh.include
  6. 4
      tools/dockerfile/interoptest/grpc_interop_python/build_interop.sh
  7. 5
      tools/dockerfile/interoptest/grpc_interop_pythonasyncio/Dockerfile
  8. 6
      tools/dockerfile/interoptest/grpc_interop_pythonasyncio/build_interop.sh
  9. 8
      tools/run_tests/run_interop_tests.py

@ -236,14 +236,14 @@ class RunInterop(test.test):
user_options = [('args=', 'a', 'pass-thru arguments for the client/server'),
('client', 'c', 'flag indicating to run the client'),
('server', 's', 'flag indicating to run the server'),
('asyncio', 'i', 'flag indicating to run the asyncio stack')
('use_asyncio', 'i', 'flag indicating to run the asyncio stack')
]
def initialize_options(self):
self.args = ''
self.client = False
self.server = False
self.asyncio = False
self.use_asyncio = False
def finalize_options(self):
if self.client and self.server:
@ -264,7 +264,7 @@ class RunInterop(test.test):
def run_server(self):
# We import here to ensure that our setuptools parent has had a chance to
# edit the Python system path.
if self.asyncio:
if self.use_asyncio:
import asyncio
from tests_aio.interop import server
sys.argv[1:] = self.args.split()

@ -0,0 +1,3 @@
%YAML 1.2
--- |
<%include file="../../python_build_interop.sh.include"/>

@ -0,0 +1,20 @@
%YAML 1.2
--- |
# Copyright 2015 gRPC authors.
#
# 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
#
# http://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.
<%include file="../../python_stretch.include"/>
RUN apt-get update && apt-get -t stable install -y python3.7 python3-all-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7

@ -0,0 +1,3 @@
%YAML 1.2
--- |
<%include file="../../python_build_interop.sh.include"/>

@ -0,0 +1,32 @@
#!/bin/bash
# Copyright 2015 gRPC authors.
#
# 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
#
# http://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.
#
# Builds Python interop server and client in a base image.
set -e
mkdir -p /var/local/git
git clone /var/local/jenkins/grpc /var/local/git/grpc
# clone gRPC submodules, use data from locally cloned submodules where possible
(cd /var/local/jenkins/grpc/ && git submodule foreach 'cd /var/local/git/grpc \
&& git submodule update --init --reference /var/local/jenkins/grpc/${"${name}"} \
${"${name}"}')
# copy service account keys if available
cp -r /var/local/jenkins/service_account $HOME || true
cd /var/local/git/grpc
# interop tests only run using python3.7 currently (and python build is slow)
tools/run_tests/run_tests.py -l python --compiler python3.7 -c opt --build_only

@ -19,9 +19,7 @@ set -e
mkdir -p /var/local/git
git clone /var/local/jenkins/grpc /var/local/git/grpc
# clone gRPC submodules, use data from locally cloned submodules where possible
(cd /var/local/jenkins/grpc/ && git submodule foreach 'cd /var/local/git/grpc \
&& git submodule update --init --reference /var/local/jenkins/grpc/${name} \
${name}')
(cd /var/local/jenkins/grpc/ && git submodule foreach 'cd /var/local/git/grpc && git submodule update --init --reference /var/local/jenkins/grpc/${name} ${name}')
# copy service account keys if available
cp -r /var/local/jenkins/service_account $HOME || true

@ -1,4 +1,4 @@
# Copyright 2019 The gRPC Authors
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -63,6 +63,7 @@ RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local
RUN mkdir /var/local/jenkins
# Install Python 3.7
RUN apt-get update && apt-get -t stable install -y python3.7 python3-all-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7

@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2019 The gRPC Authors
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -19,9 +19,7 @@ set -e
mkdir -p /var/local/git
git clone /var/local/jenkins/grpc /var/local/git/grpc
# clone gRPC submodules, use data from locally cloned submodules where possible
(cd /var/local/jenkins/grpc/ && git submodule foreach 'cd /var/local/git/grpc \
&& git submodule update --init --reference /var/local/jenkins/grpc/${name} \
${name}')
(cd /var/local/jenkins/grpc/ && git submodule foreach 'cd /var/local/git/grpc && git submodule update --init --reference /var/local/jenkins/grpc/${name} ${name}')
# copy service account keys if available
cp -r /var/local/jenkins/service_account $HOME || true

@ -668,7 +668,7 @@ class PythonLanguage:
return 'python'
class PythonAsyncIOClient:
class PythonAsyncIOLanguage:
def __init__(self):
self.client_cwd = None
@ -679,7 +679,7 @@ class PythonAsyncIOClient:
def client_cmd(self, args):
return [
'py37_native/bin/python', 'src/python/grpcio_tests/setup.py',
'run_interop', '--client', '--args="{}"'.format(' '.join(args))
'run_interop', '--use_asyncio', '--client', '--args="{}"'.format(' '.join(args))
]
def client_cmd_http2interop(self, args):
@ -694,7 +694,7 @@ class PythonAsyncIOClient:
def server_cmd(self, args):
return [
'py37_native/bin/python', 'src/python/grpcio_tests/setup.py',
'run_interop', '--asyncio', '--server',
'run_interop', '--use_asyncio', '--server',
'--args="{}"'.format(' '.join(args))
]
@ -738,7 +738,7 @@ _LANGUAGES = {
'objc': ObjcLanguage(),
'ruby': RubyLanguage(),
'python': PythonLanguage(),
'pythonasyncio': PythonAsyncIOClient(),
'pythonasyncio': PythonAsyncIOLanguage(),
}
# languages supported as cloud_to_cloud servers

Loading…
Cancel
Save