test(sdk): validate handle_response status and length edge cases#3202
Open
ankushT369 wants to merge 1 commit intoapache:masterfrom
Open
test(sdk): validate handle_response status and length edge cases#3202ankushT369 wants to merge 1 commit intoapache:masterfrom
ankushT369 wants to merge 1 commit intoapache:masterfrom
Conversation
Author
|
@hubcio Hi can you please review this ? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3202 +/- ##
=============================================
- Coverage 74.10% 53.57% -20.53%
Complexity 943 943
=============================================
Files 1159 1158 -1
Lines 102033 93556 -8477
Branches 79083 70623 -8460
=============================================
- Hits 75607 50125 -25482
- Misses 23765 40974 +17209
+ Partials 2661 2457 -204
🚀 New features to boost your workflow:
|
hubcio
requested changes
Apr 30, 2026
| async fn should_return_ok_when_length_is_less_than_data() { | ||
| let mut stream = make_dummy_stream(&[1u8; 10]).await; | ||
| let tcp_client = TcpClient::handle_response(0, 5, &mut stream).await; | ||
| assert!(tcp_client.is_ok()); |
Contributor
There was a problem hiding this comment.
missing length == 1 boundary. guard is if length <= 1. tests cover 0 and 5; 1 is the inclusive edge, off-by-one risk if guard becomes <. add handle_response(0, 1, ...) == Ok(Bytes::new()).
Add tests to ensure handle_response returns errors for non-zero status codes and when declared length exceeds available data. Also verify successful responses for valid status and bounded lengths. test(sdk): validate handle_response status and length edge cases
66d9ea9 to
c5c2c13
Compare
Author
|
@hubcio Hey I didnt get the Check status failing in the previous commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rationale
Tests for
handle_responsedid not cover important edge cases around status codes and response length, leaving potential failure scenarios unverified.What changed?
handle_responsebehavior was not validated for error conditions such as non-zero status codes or when the declared response length exceeds available data.Added unit tests covering both success and failure paths, including boundary conditions for status and length handling.
AI Usage
None