test: fix flaky test for blocking pull shutdown #378
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #372.
If a test is run in a suite with other system tests, the messages are not always published in batch sizes as desired, which can affect how ACKs are handled on the backend (the server requires all messages published in a single batch to be ACK-ed in order
to accept the ACKs).
If a publisher client instance is shared between the tests, the batching can apparently be affected, thus we create a new client
instance before each test. Since these tests are slow system tests, the overhead should not be significant.
Steps to verify
Apply the following patch to the code, disable capturing test output (
-s
option to thepy.test
command).Run system tests in
--verbose
mode and check the output.Actual result (before the PR fix)
The system test
test_streaming_pull_blocking_shutdown
fails with a high probability.Expected result
The system test
test_streaming_pull_blocking_shutdown
consistently passes.In addition, wherever the
_publish_messages(..., batch_sizes=[...])
helper is used in the tests, the output size output should match the values passed throughbatch_sizes
. For example, intest_streaming_pull_max_messages()
,batch_sizes
is set to(7, 4, 8, 2, 10, 1, 3, 8, 6, 1)
, and the test output matches that:PR checklist: