Skip to content

Commit

Permalink
Remove flaky PubSub snapshots system test
Browse files Browse the repository at this point in the history
The PubSub backend does not give any guarantees about when a message
will be re-delivered after seeking back to a snapshot, it will only
be delivered "eventually". That causes flakiness in the snapshots
test.

Since the test cannot wait for an indefinite amount of time, this
commit removes it in order to not randomly break the CI builds.
  • Loading branch information
plamut committed Jun 12, 2019
1 parent a57c9f1 commit 7f682ab
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions pubsub/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,48 +297,6 @@ def test_listing_topic_subscriptions(publisher, subscriber, project, cleanup):
assert subscriptions == {subscription_paths[0], subscription_paths[2]}


def test_using_snapshots(
publisher, subscriber, project, topic_path, subscription_path, cleanup
):
snapshot_path = subscriber.snapshot_path(project, "my-snapshot")

# Make sure the topic, subscription, and snapshot get deleted.
cleanup.append((publisher.delete_topic, topic_path))
cleanup.append((subscriber.delete_subscription, subscription_path))
cleanup.append((subscriber.delete_snapshot, snapshot_path))

# publish a message to a topic, pull and acknowledge it
publisher.create_topic(topic_path)
subscriber.create_subscription(subscription_path, topic_path)

publisher.publish(topic_path, b"Message 1")
response = subscriber.pull(subscription_path, max_messages=100)
assert len(response.received_messages) == 1
msg = response.received_messages[0]
subscriber.acknowledge(subscription_path, [msg.ack_id])

# repeat the same *after* creating a snapshot
subscriber.create_snapshot(snapshot_path, subscription_path)

publisher.publish(topic_path, b"Message 2")
response = subscriber.pull(subscription_path, max_messages=100)
msg = response.received_messages[0]
subscriber.acknowledge(subscription_path, [msg.ack_id])

# pulling again, there should be no messages received
response = subscriber.pull(
subscription_path, max_messages=100, return_immediately=True
)
assert len(response.received_messages) == 0

# after seeking to the snapshot, the second message should be received again
subscriber.seek(subscription_path, snapshot=snapshot_path)
response = subscriber.pull(subscription_path, max_messages=100)
assert len(response.received_messages) == 1
msg = response.received_messages[0]
assert msg.message.data == b"Message 2"


def test_managing_topic_iam_policy(publisher, topic_path, cleanup):
cleanup.append((publisher.delete_topic, topic_path))

Expand Down

0 comments on commit 7f682ab

Please sign in to comment.