Skip to content

Commit

Permalink
fix: add info log for bidi streaming pull ack_deadline requests (#692)
Browse files Browse the repository at this point in the history
* fix add info logg on bidi streaming pull ack_deadline changes

* adding test coverage for logging
  • Loading branch information
acocuzzo committed May 27, 2022
1 parent 235c313 commit fcb67dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -743,6 +743,9 @@ def heartbeat(self) -> bool:
request = gapic_types.StreamingPullRequest(
stream_ack_deadline_seconds=self.ack_deadline
)
_LOGGER.info(
"Sending new ack_deadline of %d seconds.", self.ack_deadline
)
else:
request = gapic_types.StreamingPullRequest()

Expand Down
Expand Up @@ -1035,7 +1035,8 @@ def test_heartbeat_inactive():
assert not result


def test_heartbeat_stream_ack_deadline_seconds():
def test_heartbeat_stream_ack_deadline_seconds(caplog):
caplog.set_level(logging.INFO)
manager = make_manager()
manager._rpc = mock.create_autospec(bidi.BidiRpc, instance=True)
manager._rpc.is_active = True
Expand All @@ -1050,6 +1051,7 @@ def test_heartbeat_stream_ack_deadline_seconds():
assert result
# Set to false after a send is initiated.
assert not manager._send_new_ack_deadline
assert "Sending new ack_deadline of 10 seconds." in caplog.text


@mock.patch("google.api_core.bidi.ResumableBidiRpc", autospec=True)
Expand Down

0 comments on commit fcb67dd

Please sign in to comment.