def test_receive_with_delivery_attempts(publisher_client, topic, subscription_dlq, capsys): _publish_messages(publisher_client, topic) subscriber.receive_messages_with_delivery_attempts(PROJECT_ID, SUBSCRIPTION_DLQ, 15) out, _ = capsys.readouterr() assert f"Listening for messages on {subscription_dlq}.." in out assert "With delivery attempts: " in out
def test_receive_with_delivery_attempts( publisher_client, topic, subscription_dlq, dead_letter_topic, capsys ): _publish_messages(publisher_client, topic) subscriber.receive_messages_with_delivery_attempts(PROJECT, SUBSCRIPTION_DLQ, 10) out, _ = capsys.readouterr() assert "Listening" in out assert subscription_dlq in out assert "Received message: " in out assert "message 4" in out assert "With delivery attempts: " in out
def run_sample(): _publish_messages(publisher_client, topic) subscriber.receive_messages_with_delivery_attempts( PROJECT_ID, SUBSCRIPTION_DLQ, 90)