Skip to content

Commit fb0af28

Browse files
ebozdumanErsan Bozduman
andauthored
Fixes the missing exception throw action when an api request is executed, like BucketExistsAsync, etc. (#1141)
* Resolves the wrong return value of BucketExistsAsync api * lint changes * review changes * Addresses ignored func test case exceptions * fix for ignored exceptions with some functional test fixes/improvements * more fixes for failing build tests * fixes lint errors * resolves RemoveIncompleteUpload test's reporting issue * incorporates review comments * lint changes * adds missing review comment change and fixes removal of incomplete upload objects logic --------- Co-authored-by: Ersan Bozduman <[email protected]>
1 parent 0dd4fd7 commit fb0af28

30 files changed

+588
-570
lines changed

FileUploader/FileUploader.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
3+
<TargetFrameworks>net8.0</TargetFrameworks>
44
<OutputType>Exe</OutputType>
55
<IsPackable>False</IsPackable>
66
</PropertyGroup>

Minio.Examples/Minio.Examples.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
3+
<TargetFrameworks>net8.0;</TargetFrameworks>
44
<OutputType>Exe</OutputType>
55
<IsPackable>False</IsPackable>
66
</PropertyGroup>

Minio.Functional.Tests/FunctionalTest.cs

Lines changed: 283 additions & 264 deletions
Large diffs are not rendered by default.

Minio.Functional.Tests/Minio.Functional.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
3+
<TargetFrameworks>net8.0</TargetFrameworks>
44
<OutputType>Exe</OutputType>
55
<IsPackable>False</IsPackable>
66
</PropertyGroup>

Minio.Functional.Tests/Program.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Minio.Functional.Tests;
2626
internal static class Program
2727
{
2828
[SuppressMessage("Design", "MA0051:Method is too long", Justification = "Needs to run all tests")]
29-
public static async Task Main(string[] args)
29+
public static async Task Main()
3030
{
3131
string endPoint = null;
3232
string accessKey = null;
@@ -107,6 +107,12 @@ public static async Task Main(string[] args)
107107

108108
ConcurrentBag<Task> functionalTestTasks = new();
109109

110+
// Test incomplete uploads
111+
await FunctionalTest.ListIncompleteUpload_Test1(minioClient).ConfigureAwait(false);
112+
await FunctionalTest.ListIncompleteUpload_Test2(minioClient).ConfigureAwait(false);
113+
await FunctionalTest.ListIncompleteUpload_Test3(minioClient).ConfigureAwait(false);
114+
await FunctionalTest.RemoveIncompleteUpload_Test(minioClient).ConfigureAwait(false);
115+
110116
// Global Notification
111117
await FunctionalTest.ListenNotifications_Test1(minioClient).ConfigureAwait(false);
112118

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

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

140146
// Test Putobject function
141147
functionalTestTasks.Add(FunctionalTest.PutObject_Test1(minioClient));
142-
functionalTestTasks.Add(FunctionalTest.PutObject_Test2(minioClient));
143148
functionalTestTasks.Add(FunctionalTest.PutObject_Test3(minioClient));
144149
functionalTestTasks.Add(FunctionalTest.PutObject_Test4(minioClient));
145150
functionalTestTasks.Add(FunctionalTest.PutObject_Test5(minioClient));
146151
functionalTestTasks.Add(FunctionalTest.PutObject_Test7(minioClient));
147152
functionalTestTasks.Add(FunctionalTest.PutObject_Test8(minioClient));
148153
functionalTestTasks.Add(FunctionalTest.PutObject_Test9(minioClient));
149-
functionalTestTasks.Add(FunctionalTest.PutObject_Test10(minioClient));
150154

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

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

216-
// Test incomplete uploads
217-
//functionalTestTasks.Add(FunctionalTest.ListIncompleteUpload_Test1(minioClient));
218-
//functionalTestTasks.Add(FunctionalTest.ListIncompleteUpload_Test2(minioClient));
219-
//functionalTestTasks.Add(FunctionalTest.ListIncompleteUpload_Test3(minioClient));
220-
//functionalTestTasks.Add(FunctionalTest.RemoveIncompleteUpload_Test(minioClient));
221-
222220
// Test GetBucket policy
223221
functionalTestTasks.Add(FunctionalTest.GetBucketPolicy_Test1(minioClient));
224222

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

261259
await functionalTestTasks.ForEachAsync().ConfigureAwait(false);
260+
await FunctionalTest.PutObject_Test2(minioClient).ConfigureAwait(false);
261+
await FunctionalTest.PutObject_Test10(minioClient).ConfigureAwait(false);
262262
}
263263
}

Minio.Functional.Tests/RandomStreamGenerator.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@ namespace Minio.Functional.Tests;
2121

2222
internal sealed class RandomStreamGenerator
2323
{
24-
private readonly Random _random = new();
25-
private readonly Memory<byte> _seedBuffer;
24+
private readonly Random random = new();
25+
private readonly Memory<byte> seedBuffer;
2626

2727
public RandomStreamGenerator(int maxBufferSize)
2828
{
29-
_seedBuffer = new byte[maxBufferSize];
29+
seedBuffer = new byte[maxBufferSize];
3030
#if NETFRAMEWORK
3131
_random.NextBytes(_seedBuffer.Span.ToArray());
3232
#else
33-
_random.NextBytes(_seedBuffer.Span);
33+
random.NextBytes(seedBuffer.Span);
3434
#endif
3535
}
3636

3737
public Stream GenerateStreamFromSeed(int size)
3838
{
39-
var randomWindow = _random.Next(0, size);
39+
var randomWindow = random.Next(0, size);
4040

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

43-
_seedBuffer[randomWindow..size].CopyTo(buffer[..(size - randomWindow)]);
44-
_seedBuffer[..randomWindow].CopyTo(buffer.Slice(size - randomWindow, randomWindow));
43+
seedBuffer[randomWindow..size].CopyTo(buffer[..(size - randomWindow)]);
44+
seedBuffer[..randomWindow].CopyTo(buffer.Slice(size - randomWindow, randomWindow));
4545

4646
return buffer.AsStream();
4747
}

Minio.Tests/Minio.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
3+
<TargetFrameworks>net8.0</TargetFrameworks>
44
<IsPackable>False</IsPackable>
55
<AssemblyOriginatorKeyFile>..\Minio.snk</AssemblyOriginatorKeyFile>
66
<SignAssembly>true</SignAssembly>

0 commit comments

Comments
 (0)