-
Notifications
You must be signed in to change notification settings - Fork 230
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
Fixed error handling in RequestExtensions
#1057
Conversation
To the reviewer: I also noticed a minor codesmell: In line 110 and 113 there are null-checks to the |
RequestExtensions
#1041RequestExtensions
I'll start reviewing this in the morning, but first thing is to rebase the branch. |
Maybe i gonna add some tests so that this error does not happen again. |
Sounds great @holterbades ! |
Those are not null checks.
No, there is no special reason.
I think we do have size checks for an uploaded and for a downloaded object, but a hash value check would also be good. |
Response error handling was unintentionally removed in a previous commit. Added it back to the `ExecuteTaskCoreAsync` method. Fixed `NullReferenceException`-bug in the `HandleIfErrorResponse` method - `throw response.Exception;` does not make sense if the exception is null.
95d4add
to
be10cc2
Compare
`Split(...)` does not return `null`, so a `null`-check is not necessary when accessing `path`. Furthermore, converting an array twice to a list only to check the element count is inefficient - use `path.Length` directly instead.
Sure there are null-checks; I mean the Also it would be more efficient to access the element count of an array via I changed it accordingly. |
I would hand in changes to the tests in a separate PullRequest from my private account some time later. |
You have a functional test failure in
|
The Minio-server is returning an error for a specific object (`"MinIO API responded with message=At least one of the pre-conditions you specified did not hold for object: \"/minio-dotnet- example-3uvmhkjpxp0ndmg/minio-dotnet-example-yhrrlm29wq\""`). Therefore, the error message should not be exactly the expected string, but rather it should **start** with the expected string.
If you attempt to delete a bucket if it does not exist, the API returns a `404` for the not existent bucket, which is correct. So before the attempt to remove the bucket, there should be a check if it even exists. This test-bug was introduced in commit 9772a37, which also disabled the error handling for all requests - which is the reason this bug was not discovered so far.
I don't get it why the assertion is now failing but did not fail the last executions of this testrun before the error handling bug . But in my opinion this testcase is wrong: The server responds with an error, which is expected in this test case, but the error message which is returned is checked if it is exactly the expected message. In my opinion the test case should only check if the error message starts with the expected text. Furthermore there was another test bug which was introduced in the same commit mentioned in #1041 and was not discovered because of the removed error handling. |
The functional test run throws an `AssertFailedException` on `Assert.IsTrue` when executing using GitHub Actions - but executing locally works as expected. Without a hint what assertion is failing, it's not possible to fix a possible error.
hmmmh ... The test is now failing at a new location. Locally this testcase is working just fine. Maybe a race condition in the test itself? I really don't think this has something to do with my fix. |
@ebozduman Hey, I would need some help with that PR. I don't know what is going on with this tests. |
There is another PR waiting for to be reviewed, PR#1043, and I think it can help resolve some of these test failure issues. |
@ebozduman |
I just ran |
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.
LGTM
Response error handling was unintentionally removed in a previous commit. Added it back to the
ExecuteTaskCoreAsync
method. FixedNullReferenceException
-bug in theHandleIfErrorResponse
method -throw response.Exception;
does not make sense if the exception is null.Fixes #1041 , #1020 , and probably #1027