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

Fixes log format issues #865

Merged
merged 1 commit into from
Nov 22, 2017
Merged

Fixes log format issues #865

merged 1 commit into from
Nov 22, 2017

Conversation

ebozduman
Copy link
Contributor

@ebozduman ebozduman commented Nov 8, 2017

Fixes #833

return
}

args["destination"] = dst
// Set args["sourceList"] to "" to stop having 10,001 null headers logged
args["sourceList"] = ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could say something like "source array of 10001 elements".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


testName := getFuncName()
function := "ComposeObject(destination, sourceList)"
args := map[string]interface{}{
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can 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.

Done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

args := map[string]interface{}{}
testName := getFuncName()
function := "ComposeObject(destination, sourceList)"
args := map[string]interface{}{
Copy link
Collaborator

Choose a reason for hiding this comment

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

this can also 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.

Done.

args := map[string]interface{}{}
testName := getFuncName()
function := "CopyObject(destination, source)"
args := map[string]interface{}{
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can also 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.

Done.

Copy link
Collaborator

@kannappanr kannappanr left a comment

Choose a reason for hiding this comment

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

Please make the changes relating to settings args and function names in the quick test mode

Copy link
Collaborator

@kannappanr kannappanr left a comment

Choose a reason for hiding this comment

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

LGTM

// Tests bucket re-create errors.
func testMakeBucketError() {
region := "eu-central-1"

// initialize logging params
startTime := time.Now()
function := "MakeBucket(bucketName, region)"
testName := getFuncName()
function := []string{"MakeBucket(bucketName, region)"}
Copy link
Member

Choose a reason for hiding this comment

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

Isn't each test suppose to test one SDK API primarily, even though it may use many API methods? Why do we need a []string for function field in the log json? This is different from our decided format here - https://github.com/minio/mint#mint-log-format

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true, but there are still some test cases already part of the existing code, like testFunctionalV2, and testFunctional, which come as a bunch of api tests. I guess these tests have been added as part of the new QuickTest mode which is why the string array is introduced recently.

Copy link
Member

Choose a reason for hiding this comment

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

Does it mean you need to fix the test than breaking JSON?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we don't need to fix anything, imho. That is perfectly fine.
So, what I did was to accommodate these kind of test cases and handle them in a kind of a better way.
Now, when these tests run, each and every api name will be printed in the function field as part of the json file if there is an error. If all of the api tests pass, then all of the api names will be printed out in the function field as part of the json file. So, no problem.

Copy link
Member

Choose a reason for hiding this comment

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

Can you provide sample JSONs on success and failure cases?

Copy link
Contributor Author

@ebozduman ebozduman Nov 15, 2017

Choose a reason for hiding this comment

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

Here is the success example:

go build functional_tests.go;go run functional_tests.go | jq
{
  "args": {
    "bucketName": "minio-go-test-hx5t3l96fruilwyi"
  },
  "duration": 2119,
  "function": [
    "MakeBucket(bucketName, region)",
    "BucketExists(bucketName)",
    "GetBucketPolicy(bucketName, objectPrefix)",
    "SetBucketPolicy(bucketName, objectPrefix, bucketPolicy)",
    "ListBuckets()",
    "PutObject(bucketName, objectName, reader, contentType)",
    "ListObjects(bucketName, objectName, isRecursive, doneCh)",
    "ListObjectsV2(bucketName, objectName, isRecursive, doneCh)",
    "ListIncompleteUploads(bucketName, objectName, isRecursive, doneCh)",
    "GetObject(bucketName, objectName)",
    "FGetObject(bucketName, objectName, fileName)",
    "PresignedHeadObject(bucketName, objectName, expires, reqParams)",
    "PresignedGetObject(bucketName, objectName, expires, reqParams)",
    "PresignedPutObject(bucketName, objectName, expires)",
    "RemoveObject(bucketName, objectName)",
    "RemoveBucket(bucketName)"
  ],
  "name": "minio-go: testFunctional",
  "status": "PASS"
}
{
  "args": {
    "bucketName": "minio-go-test-04ihrp4hwhtm2dst",
    "objectName": "minio-go-test-04ihrp4hwhtm2dstunique-presigned"
  },
  "duration": 634,
  "function": [
    "MakeBucket(bucketName, region)",
    "BucketExists(bucketName)",
    "SetBucketPolicy(bucketName, objectPrefix, bucketPolicy)",
    "ListBuckets()",
    "ListObjects(bucketName, objectName, isRecursive, doneCh)",
    "ListIncompleteUploads(bucketName, objectName, isRecursive, doneCh)",
    "GetObject(bucketName, objectName)",
    "FGetObject(bucketName, objectName, fileName)",
    "PresignedHeadObject(bucketName, objectName, expires, reqParams)",
    "PresignedGetObject(bucketName, objectName, expires, reqParams)",
    "PresignedPutObject(bucketName, objectName, expires)"
  ],
  "name": "minio-go: testFunctionalV2",
  "status": "PASS"
}

... and here is the failure example:
(induced an error just before SetBucketPolicy api execution):

$ go build functional_tests.go;go run functional_tests.go | jq
{
  "args": {
    "bucketName": "minio-go-test-eomoglxiubs5s9h9",
    "bucketPolicy": "readonly",
    "objectPrefix": ""
  },
  "duration": 169,
  "error": "BOOM!",
  "function": [
    "SetBucketPolicy(bucketName, objectPrefix, bucketPolicy)"
  ],
  "message": "SetBucketPolicy failed",
  "name": "minio-go: testFunctional",
  "status": "FAIL"
}

Copy link
Member

@balamurugana balamurugana Nov 15, 2017

Choose a reason for hiding this comment

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

I see you change function field as array which leads to dynamic JSON i.e. other tests have the field as string (as per currently agreed JSON format). You would need to fix tests, not JSON.

Copy link
Contributor Author

@ebozduman ebozduman Nov 15, 2017

Choose a reason for hiding this comment

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

@balamurugana
The issue here is the way quick mode feature is designed and implemented. It is a break in the rule of having a single api tested in a single test case. Having a group of api tests running inside a single test case/wrapper and reporting the wrapper name without the covered api names is a shortage of information that is supposed to be conveyed to the end user. That's what is behind the code change of having function field transformed from string to array type. So, it was an attempt to accommodate the existing quick mode feature design and implementation to our existing standard with minimum effort.

Now, if we don't want to change the function field to array type, then we need to decide if we are ok with not reporting apis tested under testFunctionalV2, and testFunctional test cases.

Please let me know what you think.

We also need to make sure our whole mint team understand that grouping of api tests in one single test case is against our mint testing design philosophy.

Copy link
Contributor Author

@ebozduman ebozduman Nov 15, 2017

Choose a reason for hiding this comment

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

@balamurugana
(It is not the finest looking code, but) I kept the function field as string and populated it with the list of all apis tested.
Now here how it loooks like:

Success:

$ go build functional_tests.go;go run functional_tests.go | jq
{
  "args": {
    "bucketName": "minio-go-test-lj99jvecgld2v1rk"
  },
  "duration": 1486,
  "function": "MakeBucket(bucketName, region), BucketExists(bucketName), GetBucketPolicy(bucketName, objectPrefix), SetBucketPolicy(bucketName, objectPrefix, bucketPolicy), GetBucketPolicy(bucketName, objectPrefix), SetBucketPolicy(bucketName, objectPrefix, bucketPolicy), GetBucketPolicy(bucketName, objectPrefix), SetBucketPolicy(bucketName, objectPrefix, bucketPolicy), GetBucketPolicy(bucketName, objectPrefix), ListBuckets(), PutObject(bucketName, objectName, reader, contentType), ListObjects(bucketName, objectName, isRecursive, doneCh), ListObjectsV2(bucketName, objectName, isRecursive, doneCh), ListIncompleteUploads(bucketName, objectName, isRecursive, doneCh), GetObject(bucketName, objectName), FGetObject(bucketName, objectName, fileName), PresignedHeadObject(bucketName, objectName, expires, reqParams), PresignedHeadObject(bucketName, objectName, expires, reqParams), PresignedGetObject(bucketName, objectName, expires, reqParams), PresignedGetObject(bucketName, objectName, expires, reqParams), PresignedPutObject(bucketName, objectName, expires), PresignedPutObject(bucketName, objectName, expires), RemoveObject(bucketName, objectName), RemoveBucket(bucketName)",
  "name": "minio-go: testFunctional",
  "status": "PASS"
}
{
  "args": {
    "bucketName": "minio-go-test-oimq6as19p2ut49e",
    "objectName": "minio-go-test-oimq6as19p2ut49eunique-presigned"
  },
  "duration": 437,
  "function": "MakeBucket(bucketName, location), BucketExists(bucketName), SetBucketPolicy(bucketName, objectPrefix, bucketPolicy), ListBuckets(), ListObjects(bucketName, objectName, isRecursive, doneCh), ListIncompleteUploads(bucketName, objectName, isRecursive, doneCh), GetObject(bucketName, objectName), FGetObject(bucketName, objectName, fileName), PresignedHeadObject(bucketName, objectName, expires, reqParams), PresignedGetObject(bucketName, objectName, expires, reqParams), PresignedPutObject(bucketName, objectName, expires), GetObject(bucketName, objectName)",
  "name": "minio-go: testFunctionalV2",
  "status": "PASS"
}

Failure (error induced before BucketExists api):

go build functional_tests.go;go run functional_tests.go | jq
{
  "args": {
    "bucketName": "minio-go-test-w3i5rbgfrvh2j5xe"
  },
  "duration": 212,
  "error": "BOOM!",
  "function": "BucketExists(bucketName)",
  "message": "BucketExists failed",
  "name": "minio-go: testFunctional",
  "status": "FAIL"
}

Copy link
Member

Choose a reason for hiding this comment

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

I don't know whether I understood quick mode design/implementation here. All tests in minio-go are run in all modes i.e. there is no difference for quick and enhanced modes.

I haven't completely understood any arguments about mint JSON till now, hence I can't comment on that. I am only interested in whether I will find what/where the failure happened in tests so that I find the problem and fix it accordingly. If failure log provides such information, I am OK.

If you say below JSON helps tracing down the problem whether its in test and/or server, its good to go.

{
  "args": {
    "bucketName": "minio-go-test-w3i5rbgfrvh2j5xe"
  },
  "duration": 212,
  "error": "BOOM!",
  "function": "BucketExists(bucketName)",
  "message": "BucketExists failed",
  "name": "minio-go: testFunctional",
  "status": "FAIL"
}

@nitisht
Copy link
Contributor

nitisht commented Nov 20, 2017

@ebozduman can you please address the conflicts and travis failures

@deekoder
Copy link
Contributor

Waiting on build failures to get resolved.

@ebozduman ebozduman force-pushed the log_format branch 2 times, most recently from 1e82ad2 to a7a9fb0 Compare November 20, 2017 23:41
@deekoder deekoder merged commit f56a10c into minio:master Nov 22, 2017
@ebozduman ebozduman deleted the log_format branch November 22, 2017 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants