Skip to content

Fixes the missing exception throw action when an api request is executed, like BucketExistsAsync, etc. #1141

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

Merged
Merged
2 changes: 1 addition & 1 deletion FileUploader/FileUploader.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<IsPackable>False</IsPackable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Minio.Examples.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
<TargetFrameworks>net8.0;</TargetFrameworks>
<OutputType>Exe</OutputType>
<IsPackable>False</IsPackable>
</PropertyGroup>
Expand Down
547 changes: 283 additions & 264 deletions Minio.Functional.Tests/FunctionalTest.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Minio.Functional.Tests/Minio.Functional.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<IsPackable>False</IsPackable>
</PropertyGroup>
Expand Down
24 changes: 12 additions & 12 deletions Minio.Functional.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Minio.Functional.Tests;
internal static class Program
{
[SuppressMessage("Design", "MA0051:Method is too long", Justification = "Needs to run all tests")]
public static async Task Main(string[] args)
public static async Task Main()
{
string endPoint = null;
string accessKey = null;
Expand Down Expand Up @@ -107,6 +107,12 @@ public static async Task Main(string[] args)

ConcurrentBag<Task> functionalTestTasks = new();

// Test incomplete uploads
await FunctionalTest.ListIncompleteUpload_Test1(minioClient).ConfigureAwait(false);
await FunctionalTest.ListIncompleteUpload_Test2(minioClient).ConfigureAwait(false);
await FunctionalTest.ListIncompleteUpload_Test3(minioClient).ConfigureAwait(false);
await FunctionalTest.RemoveIncompleteUpload_Test(minioClient).ConfigureAwait(false);

// Global Notification
await FunctionalTest.ListenNotifications_Test1(minioClient).ConfigureAwait(false);

Expand All @@ -116,8 +122,8 @@ public static async Task Main(string[] args)
// "Listening for bucket notification is specific only to `minio`
// server endpoints".
await FunctionalTest.ListenBucketNotificationsAsync_Test1(minioClient).ConfigureAwait(false);
await FunctionalTest.ListenBucketNotificationsAsync_Test3(minioClient).ConfigureAwait(false);
functionalTestTasks.Add(FunctionalTest.ListenBucketNotificationsAsync_Test2(minioClient));
functionalTestTasks.Add(FunctionalTest.ListenBucketNotificationsAsync_Test3(minioClient));

// Check if bucket exists
functionalTestTasks.Add(FunctionalTest.BucketExists_Test(minioClient));
Expand All @@ -139,23 +145,21 @@ public static async Task Main(string[] args)

// Test Putobject function
functionalTestTasks.Add(FunctionalTest.PutObject_Test1(minioClient));
functionalTestTasks.Add(FunctionalTest.PutObject_Test2(minioClient));
functionalTestTasks.Add(FunctionalTest.PutObject_Test3(minioClient));
functionalTestTasks.Add(FunctionalTest.PutObject_Test4(minioClient));
functionalTestTasks.Add(FunctionalTest.PutObject_Test5(minioClient));
functionalTestTasks.Add(FunctionalTest.PutObject_Test7(minioClient));
functionalTestTasks.Add(FunctionalTest.PutObject_Test8(minioClient));
functionalTestTasks.Add(FunctionalTest.PutObject_Test9(minioClient));
functionalTestTasks.Add(FunctionalTest.PutObject_Test10(minioClient));

// Test StatObject function
functionalTestTasks.Add(FunctionalTest.StatObject_Test1(minioClient));

// Test GetObjectAsync function
functionalTestTasks.Add(FunctionalTest.GetObject_Test1(minioClient));
functionalTestTasks.Add(FunctionalTest.GetObject_Test2(minioClient));
functionalTestTasks.Add(FunctionalTest.GetObjectNegObjNotFound_Test3(minioClient));
functionalTestTasks.Add(FunctionalTest.GetObjectNegBcktNotFound_Test4(minioClient));
functionalTestTasks.Add(FunctionalTest.GetObjectNegObjNotFound_Test1andTest2(minioClient));
functionalTestTasks.Add(FunctionalTest.GetObjectNegBcktNotFound_Test3(minioClient));
// 3 tests will run to check different values of offset and length parameters
// when GetObject api returns part of the object as defined by the offset
// and length parameters. Tests will be reported as GetObject_Test3,
Expand Down Expand Up @@ -213,12 +217,6 @@ public static async Task Main(string[] args)
functionalTestTasks.Add(FunctionalTest.PresignedPutObject_Test2(minioClient));
// FunctionalTest.PresignedPostPolicy_Test1(minioClient).Wait();

// Test incomplete uploads
//functionalTestTasks.Add(FunctionalTest.ListIncompleteUpload_Test1(minioClient));
//functionalTestTasks.Add(FunctionalTest.ListIncompleteUpload_Test2(minioClient));
//functionalTestTasks.Add(FunctionalTest.ListIncompleteUpload_Test3(minioClient));
//functionalTestTasks.Add(FunctionalTest.RemoveIncompleteUpload_Test(minioClient));

// Test GetBucket policy
functionalTestTasks.Add(FunctionalTest.GetBucketPolicy_Test1(minioClient));

Expand Down Expand Up @@ -259,5 +257,7 @@ public static async Task Main(string[] args)
}

await functionalTestTasks.ForEachAsync().ConfigureAwait(false);
await FunctionalTest.PutObject_Test2(minioClient).ConfigureAwait(false);
await FunctionalTest.PutObject_Test10(minioClient).ConfigureAwait(false);
}
}
14 changes: 7 additions & 7 deletions Minio.Functional.Tests/RandomStreamGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ namespace Minio.Functional.Tests;

internal sealed class RandomStreamGenerator
{
private readonly Random _random = new();
private readonly Memory<byte> _seedBuffer;
private readonly Random random = new();
private readonly Memory<byte> seedBuffer;

public RandomStreamGenerator(int maxBufferSize)
{
_seedBuffer = new byte[maxBufferSize];
seedBuffer = new byte[maxBufferSize];
#if NETFRAMEWORK
_random.NextBytes(_seedBuffer.Span.ToArray());
#else
_random.NextBytes(_seedBuffer.Span);
random.NextBytes(seedBuffer.Span);
#endif
}

public Stream GenerateStreamFromSeed(int size)
{
var randomWindow = _random.Next(0, size);
var randomWindow = random.Next(0, size);

Memory<byte> buffer = new byte[size];

_seedBuffer[randomWindow..size].CopyTo(buffer[..(size - randomWindow)]);
_seedBuffer[..randomWindow].CopyTo(buffer.Slice(size - randomWindow, randomWindow));
seedBuffer[randomWindow..size].CopyTo(buffer[..(size - randomWindow)]);
seedBuffer[..randomWindow].CopyTo(buffer.Slice(size - randomWindow, randomWindow));

return buffer.AsStream();
}
Expand Down
2 changes: 1 addition & 1 deletion Minio.Tests/Minio.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<IsPackable>False</IsPackable>
<AssemblyOriginatorKeyFile>..\Minio.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
Expand Down
Loading