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

fix(sample): mitigate flakiness in subscriber_test - #304

Merged
anguillanneuf merged 6 commits into
googleapis:masterfrom
tmatsuo:fix-sample-test
Mar 2, 2021
Merged

fix(sample): mitigate flakiness in subscriber_test#304
anguillanneuf merged 6 commits into
googleapis:masterfrom
tmatsuo:fix-sample-test

Conversation

@tmatsuo

@tmatsuo tmatsuo commented Mar 2, 2021

Copy link
Copy Markdown
Contributor

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 anguillanneuf March 2, 2021 01:31
@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

@anguillanneuf anguillanneuf left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

tmatsuo commented Mar 2, 2021

Copy link
Copy Markdown
Contributor Author

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

@tmatsuo

tmatsuo commented Mar 2, 2021

Copy link
Copy Markdown
Contributor Author

@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 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. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

samples.snippets.quickstart.quickstart_test: test_sub failed samples.snippets.subscriber_test: test_receive_synchronously_with_lease failed

3 participants