Skip to content

Commit

Permalink
[Python tests] Allow passing kwargs to grpc.server in test_server (#3…
Browse files Browse the repository at this point in the history
…6455)

Allow passing `kwargs` to `grpc.server` in test server.

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #36455

COPYBARA_INTEGRATE_REVIEW=#36455 from XuanWang-Amos:disable_reflection_in_tests d9a7e3d
PiperOrigin-RevId: 629149234
  • Loading branch information
XuanWang-Amos authored and Copybara-Service committed Apr 29, 2024
1 parent 79e42f9 commit 4318b7e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/python/grpcio_tests/tests/unit/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
# limitations under the License.
"""Common code used throughout tests of gRPC."""

import ast
import collections
from concurrent import futures
import os
import threading

import grpc
Expand Down Expand Up @@ -110,9 +112,12 @@ def test_server(max_workers=10, reuse_port=False):
These servers have SO_REUSEPORT disabled to prevent cross-talk.
"""
server_kwargs = os.environ.get("GRPC_ADDITIONAL_SERVER_KWARGS", "{}")
server_kwargs = ast.literal_eval(server_kwargs)
return grpc.server(
futures.ThreadPoolExecutor(max_workers=max_workers),
options=(("grpc.so_reuseport", int(reuse_port)),),
**server_kwargs,
)


Expand Down

0 comments on commit 4318b7e

Please sign in to comment.