Rehome python bazel distribtest (#29275)
* WIP * Test multiple languages * Yapf * isort * Shellcheck * comment not provided * Fix import ordering issue. * Turn up Bazel logging
This commit is contained in:
parent
2fd632a4c1
commit
f688f5fcf2
|
|
@ -20,8 +20,9 @@ third_party/re2
|
|||
third_party/upb
|
||||
third_party/xds
|
||||
|
||||
bazel/test/python_test_repo
|
||||
test/distrib/bazel/cpp
|
||||
test/distrib/bazel/python
|
||||
test/distrib/bazel/python_second_test_repo
|
||||
|
||||
# Directories generated by setuptools build containing BUILD files.
|
||||
src/python/grpcio_tests/src/
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
../../../../tools/bazel
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
local_repository(
|
||||
name = "com_github_grpc_grpc",
|
||||
path = "../../..",
|
||||
path = "../../../..",
|
||||
)
|
||||
|
||||
# Ensure rules don't rely on __main__ naming convention.
|
||||
|
|
@ -13,16 +13,15 @@
|
|||
# limitations under the License.
|
||||
"""The Python implementation of the GRPC helloworld.Greeter client."""
|
||||
|
||||
from concurrent import futures
|
||||
import contextlib
|
||||
import datetime
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
import grpc
|
||||
|
||||
from google.protobuf import duration_pb2
|
||||
from google.protobuf import timestamp_pb2
|
||||
from concurrent import futures
|
||||
import grpc
|
||||
import helloworld_pb2
|
||||
import helloworld_pb2_grpc
|
||||
|
||||
|
|
@ -56,6 +55,7 @@ def _listening_server():
|
|||
|
||||
|
||||
class ImportTest(unittest.TestCase):
|
||||
|
||||
def test_import(self):
|
||||
with _listening_server() as port:
|
||||
with grpc.insecure_channel('{}:{}'.format(_HOST, port)) as channel:
|
||||
|
|
@ -66,7 +66,7 @@ class ImportTest(unittest.TestCase):
|
|||
name='you',
|
||||
request_initiation=request_timestamp,
|
||||
),
|
||||
wait_for_ready=True)
|
||||
wait_for_ready=True)
|
||||
self.assertEqual(response.message, "Hello, you!")
|
||||
self.assertGreater(response.request_duration.nanos, 0)
|
||||
|
||||
|
|
@ -13,18 +13,20 @@
|
|||
# limitations under the License.
|
||||
"""The Python implementation of the GRPC helloworld.Greeter client."""
|
||||
|
||||
from concurrent import futures
|
||||
import contextlib
|
||||
import datetime
|
||||
import logging
|
||||
import unittest
|
||||
|
||||
# TODO(https://github.com/grpc/grpc/issues/29284)
|
||||
# isort: off
|
||||
import grpc
|
||||
|
||||
from google.protobuf import duration_pb2
|
||||
from google.protobuf import timestamp_pb2
|
||||
from concurrent import futures
|
||||
from google.cloud import helloworld_pb2
|
||||
from google.cloud import helloworld_pb2_grpc
|
||||
# isort: on
|
||||
|
||||
_HOST = 'localhost'
|
||||
_SERVER_ADDRESS = '{}:0'.format(_HOST)
|
||||
|
|
@ -56,6 +58,7 @@ def _listening_server():
|
|||
|
||||
|
||||
class ImportTest(unittest.TestCase):
|
||||
|
||||
def test_import(self):
|
||||
with _listening_server() as port:
|
||||
with grpc.insecure_channel('{}:{}'.format(_HOST, port)) as channel:
|
||||
|
|
@ -66,7 +69,7 @@ class ImportTest(unittest.TestCase):
|
|||
name='you',
|
||||
request_initiation=request_timestamp,
|
||||
),
|
||||
wait_for_ready=True)
|
||||
wait_for_ready=True)
|
||||
self.assertEqual(response.message, "Hello, you!")
|
||||
self.assertGreater(response.request_duration.nanos, 0)
|
||||
|
||||
|
|
@ -17,15 +17,19 @@ import unittest
|
|||
|
||||
|
||||
class ImportTest(unittest.TestCase):
|
||||
|
||||
def test_import(self):
|
||||
from foo.bar.namespaced.upper.example.namespaced_example_pb2 import NamespacedExample
|
||||
from foo.bar.namespaced.upper.example.namespaced_example_pb2 import \
|
||||
NamespacedExample
|
||||
namespaced_example = NamespacedExample()
|
||||
namespaced_example.value = "hello"
|
||||
# Dummy assert, important part is namespaced example was imported.
|
||||
# Superfluous assert, important part is namespaced example was imported.
|
||||
self.assertEqual(namespaced_example.value, "hello")
|
||||
|
||||
def test_grpc(self):
|
||||
from foo.bar.namespaced.upper.example.namespaced_example_pb2_grpc import NamespacedServiceStub
|
||||
from foo.bar.namespaced.upper.example.namespaced_example_pb2_grpc import \
|
||||
NamespacedServiceStub
|
||||
|
||||
# No error from import
|
||||
self.assertEqual(1, 1)
|
||||
|
||||
|
|
@ -17,15 +17,17 @@ import unittest
|
|||
|
||||
|
||||
class ImportTest(unittest.TestCase):
|
||||
|
||||
def test_import(self):
|
||||
from foo.bar.namespaced_example_pb2 import NamespacedExample
|
||||
namespaced_example = NamespacedExample()
|
||||
namespaced_example.value = "hello"
|
||||
# Dummy assert, important part is namespaced example was imported.
|
||||
# Superfluous assert, important part is namespaced example was imported.
|
||||
self.assertEqual(namespaced_example.value, "hello")
|
||||
|
||||
def test_grpc(self):
|
||||
from foo.bar.namespaced_example_pb2_grpc import NamespacedServiceStub
|
||||
|
||||
# No error from import
|
||||
self.assertEqual(1, 1)
|
||||
|
||||
|
|
@ -17,15 +17,19 @@ import unittest
|
|||
|
||||
|
||||
class ImportTest(unittest.TestCase):
|
||||
|
||||
def test_import(self):
|
||||
from namespaced.upper.example.namespaced_example_pb2 import NamespacedExample
|
||||
from namespaced.upper.example.namespaced_example_pb2 import \
|
||||
NamespacedExample
|
||||
namespaced_example = NamespacedExample()
|
||||
namespaced_example.value = "hello"
|
||||
# Dummy assert, important part is namespaced example was imported.
|
||||
# Superfluous assert, important part is namespaced example was imported.
|
||||
self.assertEqual(namespaced_example.value, "hello")
|
||||
|
||||
def test_grpc(self):
|
||||
from namespaced.upper.example.namespaced_example_pb2_grpc import NamespacedServiceStub
|
||||
from namespaced.upper.example.namespaced_example_pb2_grpc import \
|
||||
NamespacedServiceStub
|
||||
|
||||
# No error from import
|
||||
self.assertEqual(1, 1)
|
||||
|
||||
|
|
@ -17,15 +17,17 @@ import unittest
|
|||
|
||||
|
||||
class ImportTest(unittest.TestCase):
|
||||
|
||||
def test_import(self):
|
||||
from namespaced_example_pb2 import NamespacedExample
|
||||
namespaced_example = NamespacedExample()
|
||||
namespaced_example.value = "hello"
|
||||
# Dummy assert, important part is namespaced example was imported.
|
||||
# Superfluous assert, important part is namespaced example was imported.
|
||||
self.assertEqual(namespaced_example.value, "hello")
|
||||
|
||||
def test_grpc(self):
|
||||
from namespaced_example_pb2_grpc import NamespacedServiceStub
|
||||
|
||||
# No error from import
|
||||
self.assertEqual(1, 1)
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../../../tools/bazel
|
||||
|
|
@ -41,6 +41,11 @@ EXCLUDED_TARGETS=(
|
|||
"-//examples/android/binder/..."
|
||||
)
|
||||
|
||||
TEST_DIRECTORIES=(
|
||||
"cpp"
|
||||
"python"
|
||||
)
|
||||
|
||||
FAILED_TESTS=""
|
||||
|
||||
export OVERRIDE_BAZEL_VERSION="$VERSION"
|
||||
|
|
@ -48,9 +53,13 @@ export OVERRIDE_BAZEL_VERSION="$VERSION"
|
|||
export OVERRIDE_BAZEL_WRAPPER_DOWNLOAD_DIR=/tmp
|
||||
bazel build -- //... "${EXCLUDED_TARGETS[@]}" || FAILED_TESTS="${FAILED_TESTS}Build "
|
||||
|
||||
cd test/distrib/bazel/cpp/
|
||||
for TEST_DIRECTORY in "${TEST_DIRECTORIES[@]}"; do
|
||||
pushd "test/distrib/bazel/$TEST_DIRECTORY/"
|
||||
|
||||
bazel test //:all || FAILED_TESTS="${FAILED_TESTS}C++ Distribtest"
|
||||
bazel test --test_output=all //:all || FAILED_TESTS="${FAILED_TESTS}${TEST_DIRECTORY} Distribtest"
|
||||
|
||||
popd
|
||||
done
|
||||
|
||||
if [ "$FAILED_TESTS" != "" ]
|
||||
then
|
||||
|
|
|
|||
|
|
@ -29,10 +29,3 @@ BAZEL_FLAGS="--test_output=errors"
|
|||
bazel test ${BAZEL_FLAGS} ${TEST_TARGETS}
|
||||
bazel test --config=python_single_threaded_unary_stream ${BAZEL_FLAGS} ${TEST_TARGETS}
|
||||
bazel test --config=python_poller_engine ${BAZEL_FLAGS} ${TEST_TARGETS}
|
||||
|
||||
|
||||
# TODO(https://github.com/grpc/grpc/issues/19854): Move this to a new Kokoro
|
||||
# job.
|
||||
(cd /var/local/git/grpc/bazel/test/python_test_repo;
|
||||
bazel test --test_output=errors //...
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue