Skip to content

Commit

Permalink
Resolves the wrong return value of BucketExistsAsync api
Browse files Browse the repository at this point in the history
  • Loading branch information
Ersan Bozduman committed Jul 24, 2024
1 parent a2589e1 commit 50b3c03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Minio.Functional.Tests/FunctionalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,21 +371,26 @@ internal static async Task BucketExists_Test(IMinioClient minio)
await minio.RemoveBucketAsync(rbArgs).ConfigureAwait(false);

var found = await minio.BucketExistsAsync(beArgs).ConfigureAwait(false);
Assert.IsFalse(found);
if (found)
throw(new Exception("BucketExistsAsync api failed to return false for a non-existing bucket"));

await minio.MakeBucketAsync(mbArgs).ConfigureAwait(false);
found = await minio.BucketExistsAsync(beArgs).ConfigureAwait(false);
Assert.IsTrue(found);
new MintLogger(nameof(BucketExists_Test), bucketExistsSignature, "Tests whether BucketExists passes",

if (!found)
throw(new Exception("BucketExistsAsync api failed to return true for an existing bucket"));

new MintLogger(nameof(BucketExists_Test), bucketExistsSignature, "Tests whether BucketExistsAsync api passes",
TestStatus.PASS, DateTime.Now - startTime, args: args).Log();
}
catch (NotImplementedException ex)
{
new MintLogger(nameof(BucketExists_Test), bucketExistsSignature, "Tests whether BucketExists passes",
new MintLogger(nameof(BucketExists_Test), bucketExistsSignature, "Tests whether BucketExistsAsync api passes",
TestStatus.NA, DateTime.Now - startTime, ex.Message, ex.ToString(), args: args).Log();
}
catch (Exception ex)
{
new MintLogger(nameof(BucketExists_Test), bucketExistsSignature, "Tests whether BucketExists passes",
new MintLogger(nameof(BucketExists_Test), bucketExistsSignature, "Tests whether BucketExistsAsync api passes",
TestStatus.FAIL, DateTime.Now - startTime, ex.Message, ex.ToString(), args: args).Log();
throw;
}
Expand Down
3 changes: 3 additions & 0 deletions Minio/RequestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ await requestMessageBuilder.ResponseWriter(responseResult.ContentStream, cancell
throw new BucketNotFoundException();

if (responseResult is not null)
{
responseResult.Exception = ex;
throw;
}
else
responseResult = new ResponseResult(request, ex);
return responseResult;
Expand Down

0 comments on commit 50b3c03

Please sign in to comment.