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

[BEAM-14439] [BEAM-12673] Add extra details to PubSub matcher errors #17586

Merged
merged 1 commit into from
May 9, 2022

Conversation

yeandy
Copy link
Contributor

@yeandy yeandy commented May 9, 2022

Adding more details to the error message to PubSubMessageMatcher when the actual and expected messages don't match. This will aid in future debugging when test jobs fail.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@asf-ci
Copy link

asf-ci commented May 9, 2022

Can one of the admins verify this patch?

1 similar comment
@asf-ci
Copy link

asf-ci commented May 9, 2022

Can one of the admins verify this patch?

@yeandy yeandy changed the title []Add extra details to PubSub matcher errors [BEAM-14439] Add extra details to PubSub matcher errors May 9, 2022
@codecov
Copy link

codecov bot commented May 9, 2022

Codecov Report

Merging #17586 (71baac9) into master (7312377) will increase coverage by 0.08%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #17586      +/-   ##
==========================================
+ Coverage   73.83%   73.91%   +0.08%     
==========================================
  Files         691      692       +1     
  Lines       91252    91598     +346     
==========================================
+ Hits        67373    67706     +333     
- Misses      22647    22660      +13     
  Partials     1232     1232              
Flag Coverage Δ
python 83.71% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../python/apache_beam/io/gcp/tests/pubsub_matcher.py 91.57% <100.00%> (+1.10%) ⬆️
...s/interactive/dataproc/dataproc_cluster_manager.py 84.21% <0.00%> (-3.70%) ⬇️
sdks/python/apache_beam/coders/row_coder.py 94.49% <0.00%> (-2.65%) ⬇️
sdks/python/apache_beam/runners/common.py 87.94% <0.00%> (-2.33%) ⬇️
...ive/messaging/interactive_environment_inspector.py 96.66% <0.00%> (-1.21%) ⬇️
...hon/apache_beam/runners/direct/test_stream_impl.py 93.28% <0.00%> (-0.75%) ⬇️
...ks/python/apache_beam/runners/interactive/utils.py 95.06% <0.00%> (-0.35%) ⬇️
...hon/apache_beam/runners/worker/bundle_processor.py 93.30% <0.00%> (-0.21%) ⬇️
...che_beam/runners/interactive/interactive_runner.py 90.64% <0.00%> (-0.20%) ⬇️
...ache_beam/runners/interactive/recording_manager.py 96.56% <0.00%> (-0.02%) ⬇️
... and 25 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7312377...71baac9. Read the comment docs.

@yeandy
Copy link
Contributor Author

yeandy commented May 9, 2022

R: @tvalentyn

@tvalentyn tvalentyn changed the title [BEAM-14439] Add extra details to PubSub matcher errors [BEAM-14439] [BEAM-12673] Add extra details to PubSub matcher errors May 9, 2022
@tvalentyn
Copy link
Contributor

Thanks. You can also mention something on relevant bugs that we are looking forward to seeing this error again next time it fails.

@tvalentyn tvalentyn merged commit 0ea8095 into apache:master May 9, 2022
@lveraszto
Copy link

Hi,

thanks for the commit.

I found a little thing.
I had a custom matcher inherited from PubSubMessageMatcher.
I used in my class the _wait_for_messages function to get the message and decode it for comparison.
But my converter throws an error because the messages are now a tuple not a single list.

My old code:
// store the messages as a local variable in my custom class
self.messages = self._wait_for_messages(self.expected_msg_len, self.timeout)

and

// convert the messages for comparison
def __convert_message(self, messages): return list(map(lambda x: json.loads(x.decode("utf-8")), messages))

The error: AttributeError: 'list' object has no attribute 'decode'

My fix:
self.messages = self._wait_for_messages(self.expected_msg_len, self.timeout)[0]

@yeandy
Copy link
Contributor Author

yeandy commented Oct 14, 2022

Sorry that this broke your old code! Thanks for the update, and glad to know that you're able to make an adjustment to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants