Skip to content

Commit 2bdb813

Browse files
committed
Samples(test): Extend timeout eod receive test (googleapis#653)
* Samples(test): Mark eod test super_flaky and extend timeout
1 parent ebc76b5 commit 2bdb813

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

samples/snippets/subscriber_test.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
C = TypeVar("C", bound=Callable[..., Any])
5252

5353
typed_flaky = cast(Callable[[C], C], flaky(max_runs=3, min_passes=1))
54+
typed_super_flaky = cast(Callable[[C], C], flaky(max_runs=10, min_passes=10))
5455

5556

5657
@pytest.fixture(scope="module")
@@ -704,33 +705,26 @@ def eventually_consistent_test() -> None:
704705
eventually_consistent_test()
705706

706707

708+
@typed_super_flaky
707709
def test_receive_messages_with_exactly_once_delivery_enabled(
708710
regional_publisher_client: pubsub_v1.PublisherClient,
709711
exactly_once_delivery_topic: str,
710712
subscription_eod: str,
711713
capsys: CaptureFixture[str],
712714
) -> None:
713715

714-
typed_backoff = cast(
715-
Callable[[C], C], backoff.on_exception(backoff.expo, Unknown, max_time=300),
716+
message_ids = _publish_messages(
717+
regional_publisher_client, exactly_once_delivery_topic
716718
)
717719

718-
@typed_backoff
719-
def eventually_consistent_test() -> None:
720-
message_ids = _publish_messages(
721-
regional_publisher_client, exactly_once_delivery_topic
722-
)
723-
724-
subscriber.receive_messages_with_exactly_once_delivery_enabled(
725-
PROJECT_ID, SUBSCRIPTION_EOD, 10
726-
)
727-
728-
out, _ = capsys.readouterr()
729-
assert subscription_eod in out
730-
for message_id in message_ids:
731-
assert message_id in out
720+
subscriber.receive_messages_with_exactly_once_delivery_enabled(
721+
PROJECT_ID, SUBSCRIPTION_EOD, 200
722+
)
732723

733-
eventually_consistent_test()
724+
out, _ = capsys.readouterr()
725+
assert subscription_eod in out
726+
for message_id in message_ids:
727+
assert message_id in out
734728

735729

736730
def test_listen_for_errors(

0 commit comments

Comments
 (0)