Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

samples: fix flaky tests#233

Merged
anguillanneuf merged 10 commits into
masterfrom
anguillanneuf-patch-2
Dec 11, 2020
Merged

samples: fix flaky tests#233
anguillanneuf merged 10 commits into
masterfrom
anguillanneuf-patch-2

Conversation

@anguillanneuf

@anguillanneuf anguillanneuf commented Nov 10, 2020

Copy link
Copy Markdown
Contributor

The two tests at the end of subscriber_tests.py often cause tests to fail due to subscription NotFound error.

The order of the tests shouldn't matter, what really fixes the tests is the python version in resource names. I suspect the different runtimes were pulling messages from the same topic (created using UUID) and destroying the topic and subscription resources before the other runtimes could finish. Or the service takes too long to make topics and subscriptions (sometimes up to two minutes).

Fixes #227
Fixes #240
Fixes #246

@anguillanneuf anguillanneuf requested a review from a team as a code owner November 10, 2020 19:24
@product-auto-label product-auto-label Bot added the api: pubsub Issues related to the googleapis/python-pubsub API. label Nov 10, 2020
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 10, 2020
@anguillanneuf anguillanneuf marked this pull request as draft November 10, 2020 22:09
feat: Enable server side flow control by default with the option to turn it off (#231)

* Enable server side flow control by default with the option to turn it off

This change enables sending flow control settings automatically to the server. If flow_control.max_messages > 0 or flow_control.max_bytes > 0, flow control will be enforced at the server side (in addition to the client side).

This behavior is enabled by default and users who would like to opt-out of this feature --in case they encouter issues with server side flow control-- can pass in use_legacy_flow_control=True in SubscriberClient.subscribe().

* Enable server side flow control by default with the option to turn it off

This change enables sending flow control settings automatically to the server.
If flow_control.max_messages > 0 or flow_control.max_bytes > 0, flow control will be enforced
at the server side (in addition to the client side).

This behavior is enabled by default and users who would like to opt-out of this feature
--in case they encouter issues with server side flow control-- can pass in
use_legacy_flow_control=true in subscriberclient.subscribe().

Co-authored-by: Tianzi Cai <tianzi@google.com>

fix: replace AssertionError with NotFound

fix: add another pytest fixture in failing test

remove backoff
@leahecole

Copy link
Copy Markdown

I know this is a draft but I'm just commenting because I'm mildly concerned about the title - tests should be order independent. If something needs to exist in order for a test to run, please use pytest fixtures to do so. Or, if it's something really long running (i.e. automl trained model) we may need to explore having a static resource.

And if you already knew all of this, feel free to ignore me. and if you want to talk more ping me :)

@anguillanneuf anguillanneuf marked this pull request as ready for review December 10, 2020 21:34
@anguillanneuf anguillanneuf changed the title samples: reorder tests to fix flaky tests samples: fix flaky tests Dec 10, 2020
@anguillanneuf anguillanneuf requested a review from pradn December 10, 2020 21:37

@leahecole leahecole left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor nits, bu otherwise lgtm

Comment thread samples/snippets/subscriber_test.py Outdated
Comment thread samples/snippets/subscriber_test.py Outdated
Comment thread samples/snippets/subscriber_test.py Outdated
Comment thread samples/snippets/subscriber.py Outdated
@anguillanneuf anguillanneuf merged commit 7c532a2 into master Dec 11, 2020
@anguillanneuf anguillanneuf deleted the anguillanneuf-patch-2 branch December 11, 2020 20:28
@anguillanneuf

Copy link
Copy Markdown
Contributor Author

Fixes #240

@anguillanneuf

Copy link
Copy Markdown
Contributor Author

Fixes #246

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: pubsub Issues related to the googleapis/python-pubsub API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

3 participants