Skip to content

Commit

Permalink
[fallback] Make the get_stats timeout configurable and default to 5m
Browse files Browse the repository at this point in the history
Go test seems to fail because timeout is too short. Making it
configurable should help with the debugging. Also, setting it
to 5m may just fix the issue.
  • Loading branch information
eugeneo committed Jan 9, 2025
1 parent ba01545 commit 603992f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion framework/helpers/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ def __init__(
name: str,
url: str,
image: str,
stats_request_timeout_s: str,
):
super().__init__(
manager=manager,
Expand All @@ -278,13 +279,14 @@ def __init__(
}
},
)
self.stats_request_timeout_s = stats_request_timeout_s

def get_stats(self, num_rpcs: int):
logger.debug("Sending %d requests", num_rpcs)
stub = test_pb2_grpc.LoadBalancerStatsServiceStub(self.channel())
res = stub.GetClientStats(
messages_pb2.LoadBalancerStatsRequest(
num_rpcs=num_rpcs, timeout_sec=math.ceil(num_rpcs * 10)
num_rpcs=num_rpcs, timeout_sec=self.stats_request_timeout_s
)
)
return res
Expand Down
7 changes: 6 additions & 1 deletion tests/fallback_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
_STATUS_POLL_INTERVAL_MS = flags.DEFINE_integer(
"status_poll_interval_ms", 300, "Channel status poll interval (in ms)"
)

_STATS_REQUEST_TIMEOUT_S = flags.DEFINE_integer(
"stats_request_timeout_s",
300,
"Number of seconds the client will wait for the requested number of RPCs",
)
_LISTENER = "listener_0"

absl.flags.adopt_module_key_flags(framework.xds_k8s_testcase)
Expand Down Expand Up @@ -92,6 +96,7 @@ def start_client(self, port: int = None, name: str = None):
port=port or get_free_port(),
url=f"xds:///{_LISTENER}",
image=framework.xds_k8s_flags.CLIENT_IMAGE.value,
stats_request_timeout_s = _STATS_REQUEST_TIMEOUT_S.value,
)

def start_control_plane(
Expand Down

0 comments on commit 603992f

Please sign in to comment.