diff options
author | Martin Kraft <martinkraft@gmail.com> | 2018-05-22 12:54:00 -0400 |
---|---|---|
committer | Martin Kraft <martinkraft@gmail.com> | 2018-05-22 12:54:00 -0400 |
commit | 4c683aff7627040ff811f065848a820b2cb19d59 (patch) | |
tree | 668061e8acfd8827fd02bab18a998b7986944296 /vendor/github.com/minio/minio-go/functional_tests.go | |
parent | eb78d273f39202046fa71555a5a19b0ec8a95cb3 (diff) | |
parent | 1af1bce6199597bb2d41ddcdc00ef0f28a73c83e (diff) | |
download | chat-4c683aff7627040ff811f065848a820b2cb19d59.tar.gz chat-4c683aff7627040ff811f065848a820b2cb19d59.tar.bz2 chat-4c683aff7627040ff811f065848a820b2cb19d59.zip |
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'vendor/github.com/minio/minio-go/functional_tests.go')
-rw-r--r-- | vendor/github.com/minio/minio-go/functional_tests.go | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/vendor/github.com/minio/minio-go/functional_tests.go b/vendor/github.com/minio/minio-go/functional_tests.go index c8236d69b..421b30e8e 100644 --- a/vendor/github.com/minio/minio-go/functional_tests.go +++ b/vendor/github.com/minio/minio-go/functional_tests.go @@ -3474,15 +3474,13 @@ func testFunctional() { function = "SetBucketPolicy(bucketName, readOnlyPolicy)" functionAll += ", " + function - readOnlyPolicy := `{"Version":"2012-10-17","Statement":[{"Action":["s3:ListBucket"],"Effect":"Allow","Principal":{"AWS":["*"]},"Resource":["arn:aws:s3:::` + bucketName + `"],"Sid":""}]}` - + readOnlyPolicy := `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:ListBucket"],"Resource":["arn:aws:s3:::` + bucketName + `"]}]}` args = map[string]interface{}{ "bucketName": bucketName, "bucketPolicy": readOnlyPolicy, } err = c.SetBucketPolicy(bucketName, readOnlyPolicy) - if err != nil { logError(testName, function, args, startTime, "", "SetBucketPolicy failed", err) return @@ -3494,14 +3492,12 @@ func testFunctional() { "bucketName": bucketName, } readOnlyPolicyRet, err := c.GetBucketPolicy(bucketName) - if err != nil { logError(testName, function, args, startTime, "", "GetBucketPolicy failed", err) return } - - if strings.Compare(readOnlyPolicyRet, readOnlyPolicy) != 0 { - logError(testName, function, args, startTime, "", "policy should be set to readonly", err) + if readOnlyPolicyRet == "" { + logError(testName, function, args, startTime, "", "policy should be set", err) return } @@ -3509,8 +3505,7 @@ func testFunctional() { function = "SetBucketPolicy(bucketName, writeOnlyPolicy)" functionAll += ", " + function - writeOnlyPolicy := `{"Version":"2012-10-17","Statement":[{"Action":["s3:ListBucketMultipartUploads"],"Effect":"Allow","Principal":{"AWS":["*"]},"Resource":["arn:aws:s3:::` + bucketName + `"],"Sid":""}]}` - + writeOnlyPolicy := `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:ListBucketMultipartUploads"],"Resource":["arn:aws:s3:::` + bucketName + `"]}]}` args = map[string]interface{}{ "bucketName": bucketName, "bucketPolicy": writeOnlyPolicy, @@ -3534,8 +3529,8 @@ func testFunctional() { return } - if strings.Compare(writeOnlyPolicyRet, writeOnlyPolicy) != 0 { - logError(testName, function, args, startTime, "", "policy should be set to writeonly", err) + if writeOnlyPolicyRet == "" { + logError(testName, function, args, startTime, "", "policy should be set", err) return } @@ -3543,7 +3538,7 @@ func testFunctional() { function = "SetBucketPolicy(bucketName, readWritePolicy)" functionAll += ", " + function - readWritePolicy := `{"Version":"2012-10-17","Statement":[{"Action":["s3:ListBucket","s3:ListBucketMultipartUploads"],"Effect":"Allow","Principal":{"AWS":["*"]},"Resource":["arn:aws:s3:::` + bucketName + `"],"Sid":""}]}` + readWritePolicy := `{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":["*"]},"Action":["s3:ListBucket","s3:ListBucketMultipartUploads"],"Resource":["arn:aws:s3:::` + bucketName + `"]}]}` args = map[string]interface{}{ "bucketName": bucketName, @@ -3567,8 +3562,8 @@ func testFunctional() { return } - if strings.Compare(readWritePolicyRet, readWritePolicy) != 0 { - logError(testName, function, args, startTime, "", "policy should be set to readwrite", err) + if readWritePolicyRet == "" { + logError(testName, function, args, startTime, "", "policy should be set", err) return } @@ -5995,7 +5990,11 @@ func testStorageClassMetadataPutObject() { logError(testName, function, args, startTime, "", "Metadata verification failed, STANDARD storage class should not be a part of response metadata", err) return } - + // Delete all objects and buckets + if err = cleanupBucket(bucketName, c); err != nil { + logError(testName, function, args, startTime, "", "Cleanup failed", err) + return + } successLogger(testName, function, args, startTime).Info() } @@ -6036,7 +6035,11 @@ func testStorageClassInvalidMetadataPutObject() { logError(testName, function, args, startTime, "", "PutObject with invalid storage class passed, was expected to fail", err) return } - + // Delete all objects and buckets + if err = cleanupBucket(bucketName, c); err != nil { + logError(testName, function, args, startTime, "", "Cleanup failed", err) + return + } successLogger(testName, function, args, startTime).Info() } @@ -6136,7 +6139,11 @@ func testStorageClassMetadataCopyObject() { logError(testName, function, args, startTime, "", "Metadata verification failed, STANDARD storage class should not be a part of response metadata", err) return } - + // Delete all objects and buckets + if err = cleanupBucket(bucketName, c); err != nil { + logError(testName, function, args, startTime, "", "Cleanup failed", err) + return + } successLogger(testName, function, args, startTime).Info() } @@ -6497,7 +6504,7 @@ func testFunctionalV2() { function = "SetBucketPolicy(bucketName, bucketPolicy)" functionAll += ", " + function - readWritePolicy := `{"Version": "2012-10-17","Statement": [{"Action": ["s3:ListBucketMultipartUploads,s3:ListBucket"],"Effect": "Allow","Principal": {"AWS": ["*"]},"Resource": ["arn:aws:s3:::` + bucketName + `/*"],"Sid": ""}]}` + readWritePolicy := `{"Version": "2012-10-17","Statement": [{"Action": ["s3:ListBucketMultipartUploads", "s3:ListBucket"],"Effect": "Allow","Principal": {"AWS": ["*"]},"Resource": ["arn:aws:s3:::` + bucketName + `"],"Sid": ""}]}` args = map[string]interface{}{ "bucketName": bucketName, @@ -6558,9 +6565,9 @@ func testFunctionalV2() { return } - objectName_noLength := objectName + "-nolength" - args["objectName"] = objectName_noLength - n, err = c.PutObject(bucketName, objectName_noLength, bytes.NewReader(buf), int64(len(buf)), minio.PutObjectOptions{ContentType: "binary/octet-stream"}) + objectNameNoLength := objectName + "-nolength" + args["objectName"] = objectNameNoLength + n, err = c.PutObject(bucketName, objectNameNoLength, bytes.NewReader(buf), int64(len(buf)), minio.PutObjectOptions{ContentType: "binary/octet-stream"}) if err != nil { logError(testName, function, args, startTime, "", "PutObject failed", err) return |