Skip to content
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

Fix json logging for Mint #192

Merged
merged 1 commit into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions Minio.Functional.Tests/FunctionalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public static void Main(string[] args)
}
private static void runQuickTests(MinioClient minioClient)
{
// Check if bucket exists
// Check if bucket exists
BucketExists_Test(minioClient).Wait();

// Create a new bucket
Expand All @@ -236,7 +236,8 @@ private static void runQuickTests(MinioClient minioClient)
ListObjects_Test1(minioClient).Wait();
RemoveObject_Test1(minioClient).Wait();
CopyObject_Test1(minioClient).Wait();
// Test SetPolicyAsync function

// Test SetPolicyAsync function
SetBucketPolicy_Test1(minioClient).Wait();

// Test Presigned Get/Put operations
Expand Down Expand Up @@ -375,9 +376,6 @@ private async static Task RemoveBucket_Test1(MinioClient minio)
{
new MintLogger("RemoveBucket_Test1","Tests whether RemoveBucket passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString()).Log();
}



}
private async static Task ListBuckets_Test(MinioClient minio)
{
Expand Down Expand Up @@ -603,12 +601,12 @@ await minio.PutObjectAsync(bucketName,
await TearDown(minio, bucketName);
}
new MintLogger("PutObject_Test8","Tests whether PutObject with unknown stream-size passes",TestStatus.PASS,(DateTime.Now - startTime)).Log();
}
catch (Exception ex)
{
new MintLogger("PutObject_Test8","Tests whether PutObject with unknown stream-size passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString()).Log();
}
}
catch (Exception ex)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this exception for the outer try block is intended to catch Setup_Test failure as well as the inner using {} block. So it shouldn't be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I have just changed the indentation here @poornas block is not removed..

{
new MintLogger("PutObject_Test8","Tests whether PutObject with unknown stream-size passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString()).Log();
}
}
private async static Task PutObject_Task(MinioClient minio, string bucketName, string objectName, string fileName = null, string contentType = "application/octet-stream", long size = 0, Dictionary<string, string> metaData = null, MemoryStream mstream = null)
{
try
Expand Down Expand Up @@ -732,7 +730,7 @@ await minio.PutObjectAsync(bucketName,
}
catch (Exception e)
{
Console.WriteLine("[Bucket] Exception: {0}", e);
new MintLogger("StatObject_Test1","Tests whether StatObject passes",TestStatus.FAIL,(DateTime.Now - startTime),"",e.Message, e.ToString()).Log();
Assert.Fail();
}
await TearDown(minio, bucketName);
Expand Down Expand Up @@ -1111,7 +1109,7 @@ await minio.GetObjectAsync(bucketName, objectName,
}
catch (Exception e)
{
Console.WriteLine("[Bucket] Exception: {0}", e);
new MintLogger("GetObject_Test1","Tests whether GetObject as stream works",TestStatus.FAIL,(DateTime.Now - startTime),"",e.Message, e.ToString()).Log();
Assert.Fail();
}
await TearDown(minio, bucketName);
Expand Down Expand Up @@ -1192,7 +1190,7 @@ await minio.GetObjectAsync(bucketName, objectName, 1024L, file_write_size,
}
catch (Exception e)
{
Console.WriteLine("[Bucket] Exception: {0}", e);
new MintLogger("GetObject_Test3","Tests whether GetObject returns all the data",TestStatus.FAIL,(DateTime.Now - startTime),"",e.Message, e.ToString()).Log();
Assert.Fail();
}
await TearDown(minio, bucketName);
Expand Down Expand Up @@ -1498,11 +1496,8 @@ private async static Task RemoveObjects_Test2(MinioClient minio)
ex => Console.WriteLine("OnError: {0}", ex),
() =>
{
Console.WriteLine("Listed all delete errors for remove objects on " + bucketName + "\n");
TearDown(minio, bucketName).Wait();
});


new MintLogger("RemoveObjects_Test2","Tests whether RemoveObjectAsync for multi objects delete passes",TestStatus.PASS,(DateTime.Now - startTime)).Log();
}
catch (MinioException ex)
Expand Down Expand Up @@ -1801,7 +1796,7 @@ await minio.PutObjectAsync(bucketName,
}
catch (Exception e)
{
Console.WriteLine("[Bucket] Exception: {0}", e);
new MintLogger("ListIncompleteUpload_Test1","Tests whether ListIncompleteUpload passes",TestStatus.FAIL,(DateTime.Now - startTime),"",e.Message, e.ToString()).Log();
Assert.Fail();
}
await TearDown(minio, bucketName);
Expand Down Expand Up @@ -1848,7 +1843,7 @@ await minio.PutObjectAsync(bucketName,
}
catch (Exception e)
{
Console.WriteLine("[Bucket] Exception: {0}", e);
new MintLogger("ListIncompleteUpload_Test2","Tests whether ListIncompleteUpload passes when qualified by prefix",TestStatus.FAIL,(DateTime.Now - startTime),"",e.Message, e.ToString()).Log();
Assert.Fail();
}
await TearDown(minio, bucketName);
Expand Down Expand Up @@ -1896,7 +1891,7 @@ await minio.PutObjectAsync(bucketName,
}
catch (Exception e)
{
Console.WriteLine("[Bucket] Exception: {0}", e);
new MintLogger("ListIncompleteUpload_Test3","Tests whether ListIncompleteUpload passes when qualified by prefix and recursive",TestStatus.FAIL,(DateTime.Now - startTime),"",e.Message, e.ToString()).Log();
Assert.Fail();
}
await TearDown(minio, bucketName);
Expand Down Expand Up @@ -1944,7 +1939,7 @@ await minio.PutObjectAsync(bucketName,
}
catch (Exception e)
{
Console.WriteLine("[Bucket] Exception: {0}", e);
new MintLogger("RemoveIncompleteUpload_Test1","Tests whether RemoveIncompleteUpload passes.",TestStatus.FAIL,(DateTime.Now - startTime),"",e.Message, e.ToString()).Log();
Assert.Fail();
}
await TearDown(minio, bucketName);
Expand Down
2 changes: 1 addition & 1 deletion Minio.Functional.Tests/MintLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public MintLogger(string function, string description,TestStatus status,System.T
}
public void Log() {

Console.Out.WriteLine(JsonConvert.SerializeObject(this,Formatting.Indented,
Console.Out.WriteLine(JsonConvert.SerializeObject(this,Formatting.None,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
}
}
Expand Down