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

Fixes undefined handler passing to the gRPC stream #3779

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

olegbespalov
Copy link
Contributor

@olegbespalov olegbespalov commented Jun 7, 2024

What?

This PR fixes a panic that happens if pass undefined (null) handler to the stream.on

E.g.

stream.on("data", undefined)

Why?

We shouldn't panic

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

@olegbespalov olegbespalov added this to the v0.52.0 milestone Jun 7, 2024
@olegbespalov olegbespalov self-assigned this Jun 7, 2024
@olegbespalov olegbespalov requested a review from a team as a code owner June 7, 2024 10:10
@olegbespalov olegbespalov requested review from mstoykov and oleiade and removed request for a team June 7, 2024 10:10
@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.86%. Comparing base (e5b00db) to head (e4c6dae).

Current head e4c6dae differs from pull request most recent head de14138

Please upload reports for the commit de14138 to get more accurate results.

Files Patch % Lines
js/modules/k6/grpc/stream.go 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3779      +/-   ##
==========================================
+ Coverage   70.84%   70.86%   +0.01%     
==========================================
  Files         291      291              
  Lines       21222    21224       +2     
==========================================
+ Hits        15035    15040       +5     
+ Misses       5222     5219       -3     
  Partials      965      965              
Flag Coverage Δ
ubuntu 70.77% <66.66%> (-0.02%) ⬇️
windows 70.70% <66.66%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joanlopez
Copy link
Contributor

Similarly to what I left here, this time I think we do actually need an extra check for the sake of correctness. Right? 🤔

@joanlopez
Copy link
Contributor

Similarly to what I left here, this time I think we do actually need an extra check for the sake of correctness. Right? 🤔

I quickly checked that, and it returns a TypeError. And, although I still think the error should look pretty similar to the one returned when the handler is undefined, I'm gonna approve the PR because that corner case doesn't produce a panic, so we can address it later, in another PR.

@olegbespalov olegbespalov merged commit 80ceb35 into master Jun 7, 2024
23 checks passed
@olegbespalov olegbespalov deleted the fix/grpc-on-undefined-handler branch June 7, 2024 12:17
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