-
Notifications
You must be signed in to change notification settings - Fork 14
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
Test coverage for Client
ops
#641
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #641 +/- ##
==========================================
+ Coverage 57.47% 59.46% +1.98%
==========================================
Files 164 165 +1
Lines 22503 22751 +248
==========================================
+ Hits 12934 13529 +595
+ Misses 9175 8810 -365
- Partials 394 412 +18 ☔ View full report in Codecov by Sentry. |
a2b4e8a
to
5e78497
Compare
fb4933a
to
24b8ba8
Compare
24b8ba8
to
f3a65e3
Compare
This: - groups with wrong length case; - mentions the correct version. Signed-off-by: Leonard Lyubich <[email protected]>
Continues 0de224e. Signed-off-by: Leonard Lyubich <[email protected]>
Regression from b75db12. Since then, no error were submitted to stat handler of following `Client` ops: - `NetmapSnapshot`; - `ObjectDelete`. Now unit tests detect such things. Signed-off-by: Leonard Lyubich <[email protected]>
Previously, client did not check split info from server responses to `Head` / `Get` and `GetRange` requests. In addition to accepting a buggy or malicious response, this also resulted in undefined data in the method returns. Now split info field is strictly controlled according to the protocol. Signed-off-by: Leonard Lyubich <[email protected]>
Previously, `ObjectGetInit` and `ObjectHead` methods of the `Client` did not check whether required response fields (object header, signature and, for GET, ID) are set or not. This was incorrect since these fields are required, missing any of them makes response inappropriate. Now `Client` returns `MissingResponseFieldErr` in this case. Corresponding unit tests PASS now. Signed-off-by: Leonard Lyubich <[email protected]>
Previous 'empty attribute value K' text could confuse because K is not empty. For network info, 'attribute' is also renamed to 'parameter'. Signed-off-by: Leonard Lyubich <[email protected]>
`Client` must not attempt to send obviously invalid requests. Moreover, pre-check already existed for PUT, and these operations are similar in this sense. Signed-off-by: Leonard Lyubich <[email protected]>
`Client` signs not just payload but request parts. So, to be more precise what's going on, it's worth to narrow generic 'calculate signature' text. Moreover, PUT already results with 'calculate container signature' in the same case. Signed-off-by: Leonard Lyubich <[email protected]>
Previously, on the problem with the 1st GET stream message, `Client` returned 'header: ...' error. Such an error led to the question: header what? Now 'read header: ...' is returned. Signed-off-by: Leonard Lyubich <[email protected]>
f3a65e3
to
530bbf8
Compare
that's it for now 😅 test code may look bulky, but now it's quite detective. The maintenance is expected to be easier in the future testing allowed to revise many things. I've changed/fixed some of them right away. For less obvious and/or requiring more changes I opened several issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't review test changes here, sorry. Functional ones are OK.
@@ -153,7 +153,8 @@ func (c *Client) ObjectHash(ctx context.Context, containerID cid.ID, objectID oi | |||
|
|||
resp, err := c.object.GetRangeHash(ctx, req.ToGRPCMessage().(*protoobject.GetRangeHashRequest)) | |||
if err != nil { | |||
return nil, rpcErr(err) | |||
err = rpcErr(err) | |||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't belong to 484bd6c.
@@ -155,7 +155,7 @@ func (x *Container) readFromV2(m container.Container, checkFieldPresence bool) e | |||
|
|||
val = attrs[i].GetValue() | |||
if val == "" { | |||
return fmt.Errorf("empty attribute value %s", key) | |||
return fmt.Errorf("empty value of the attribute %s", key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty %q attribute value
would be shorter.
Client
#639)