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: enhance test on pr 583 #716

Merged
merged 2 commits into from
Feb 7, 2022
Merged

fix: enhance test on pr 583 #716

merged 2 commits into from
Feb 7, 2022

Conversation

gnought
Copy link
Collaborator

@gnought gnought commented Feb 5, 2022

In PR #583, the fix is valid but the unit test does not. The test is still pass when we revert the line back to

packet.writeCallback = next

The PR mentioned Aedes uses through2 and suffers similar bugs. The claim is partially correct. We need to do a fix but it is due to the nodejs Transform callback behaviour, in our case it is writeCallback call. We could refer to nodejs doc https://nodejs.org/docs/latest-v16.x/api/stream.html#transform_transformchunk-encoding-callback

The callback function must be called only when the current chunk is completely consumed. The first argument passed to the callback must be an Error object if an error occurred while processing the input or null otherwise. If a second argument is passed to the callback, it will be forwarded on to the transform.push() method.

This PR is to fix the unit test on PR #583.

@coveralls
Copy link

coveralls commented Feb 5, 2022

Pull Request Test Coverage Report for Build 1800150339

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.911%

Totals Coverage Status
Change from base Build 1799508029: 0.0%
Covered Lines: 800
Relevant Lines: 800

💛 - Coveralls

1 similar comment
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1800150339

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.911%

Totals Coverage Status
Change from base Build 1799508029: 0.0%
Covered Lines: 800
Relevant Lines: 800

💛 - Coveralls

@robertsLando
Copy link
Member

. We need to do a fix but it is due to the nodejs Transform callback behaviour, in our case it is writeCallback call. We could refer to nodejs doc

What could be a fix to this?

@gnought
Copy link
Collaborator Author

gnought commented Feb 7, 2022

The fix in #583 is fine, not to pass 2nd argument to in the Transform callback. :)

@gnought gnought merged commit 1743806 into main Feb 7, 2022
@gnought gnought deleted the fix/enhance-test-on-pr-583 branch February 7, 2022 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants