Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sample): mitigate flakiness in subscriber_test #304

Merged
merged 6 commits into from Mar 2, 2021

Conversation

tmatsuo
Copy link
Contributor

@tmatsuo tmatsuo commented Mar 2, 2021

fixes #289
fixes #288

I think there were few problems with the tests.

  1. google.api_core.exceptions.Unknown is not retried.
  2. number of messages published in test_receive_synchronously_with_lease
    was 5, but the sample code is fetching 3 messages in bulk.
  3. assertion in test_receive_synchronously_with_lease was too strict.
  4. failure in subscriber_test was incorrectly considered a failure in
    teardown of quickstart_test.

I hope these changes will mitigate the flakiness.

fixes googleapis#289
fixes googleapis#288

I think there were few problems with the tests.

1. google.api_core.exceptions.Unknown is not retried.
2. number of messages published in test_receive_synchronously_with_lease
   was 5, but the sample code is fetching 3 messages in bulk.
3. assertion in test_receive_synchronously_with_lease was too strict.
4. failure in subscriber_test was incorrectly considered a failure in
   teardown of quickstart_test.

I hope these changes will mitigate the flakiness.
@tmatsuo tmatsuo requested a review from a team as a code owner March 2, 2021 01:31
@tmatsuo tmatsuo requested review from engelke and removed request for a team March 2, 2021 01:31
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Mar 2, 2021
@product-auto-label product-auto-label bot added api: pubsub Issues related to the googleapis/python-pubsub API. samples Issues that are directly related to samples. labels Mar 2, 2021
Copy link
Contributor

@anguillanneuf anguillanneuf left a comment

Choose a reason for hiding this comment

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

Yah, with sync pull, we may not get the specified number of messages, so the test is too strict there.

Using unknown is also better.

LGTM.

@anguillanneuf
Copy link
Contributor

I LGTM'ed too early. Tests are still flaky (might have become flakier)

@anguillanneuf anguillanneuf self-requested a review March 2, 2021 01:41
@tmatsuo
Copy link
Contributor Author

tmatsuo commented Mar 2, 2021

@busunkim96 There is another instnace of Unkown and stream removed.

@tmatsuo
Copy link
Contributor Author

tmatsuo commented Mar 2, 2021

@anguillanneuf PTAL

@tmatsuo tmatsuo added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 2, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 2, 2021
@anguillanneuf anguillanneuf merged commit 271a385 into googleapis:master Mar 2, 2021
@tmatsuo tmatsuo deleted the fix-sample-test branch March 2, 2021 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.
Projects
None yet
3 participants