Make sanity test happy

pull/19299/head
Lidi Zheng 6 years ago
parent 7257508294
commit c4b7831f20
  1. 2
      src/python/grpcio_tests/tests/tests.json
  2. 2
      src/python/grpcio_tests/tests/unit/BUILD.bazel
  3. 14
      src/python/grpcio_tests/tests/unit/_server_wait_for_termination_test.py

@ -66,7 +66,7 @@
"unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithClientAuth",
"unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithoutClientAuth",
"unit._server_test.ServerTest",
"unit._server_wait_for_termination.ServerWaitForTerminationTest",
"unit._server_wait_for_termination_test.ServerWaitForTerminationTest",
"unit._session_cache_test.SSLSessionCacheTest",
"unit._signal_handling_test.SignalHandlingTest",
"unit._version_test.VersionTest",

@ -33,7 +33,7 @@ GRPCIO_TESTS_UNIT = [
# "_server_ssl_cert_config_test.py",
"_server_test.py",
"_server_shutdown_test.py",
"_server_wait_for_termination.py",
"_server_wait_for_termination_test.py",
"_session_cache_test.py",
]

@ -22,7 +22,6 @@ import six
import grpc
from tests.unit.framework.common import test_constants
_WAIT_FOR_BLOCKING = datetime.timedelta(seconds=1)
@ -31,13 +30,18 @@ def _block_on_waiting(server, termination_event):
server.wait_for_termination()
termination_event.set()
class ServerWaitForTerminationTest(unittest.TestCase):
def test_unblock_by_invoking_stop(self):
termination_event = threading.Event()
server = grpc.server(futures.ThreadPoolExecutor())
wait_thread = threading.Thread(target=_block_on_waiting, args=(server, termination_event,))
wait_thread = threading.Thread(
target=_block_on_waiting, args=(
server,
termination_event,
))
wait_thread.daemon = True
wait_thread.start()
time.sleep(_WAIT_FOR_BLOCKING.total_seconds())
@ -50,7 +54,11 @@ class ServerWaitForTerminationTest(unittest.TestCase):
termination_event = threading.Event()
server = grpc.server(futures.ThreadPoolExecutor())
wait_thread = threading.Thread(target=_block_on_waiting, args=(server, termination_event,))
wait_thread = threading.Thread(
target=_block_on_waiting, args=(
server,
termination_event,
))
wait_thread.daemon = True
wait_thread.start()
time.sleep(_WAIT_FOR_BLOCKING.total_seconds())
Loading…
Cancel
Save