MCPcopy
hub / github.com/minio/minio-go / testFunctional

Function testFunctional

functional_tests.go:7520–8182  ·  view source on GitHub ↗

Tests comprehensive list of all methods.

()

Source from the content-addressed store, hash-verified

7518
7519// Tests comprehensive list of all methods.
7520func testFunctional() {
7521 // initialize logging params
7522 startTime := time.Now()
7523 testName := getFuncName()
7524 function := "testFunctional()"
7525 functionAll := ""
7526 args := map[string]interface{}{}
7527
7528 c, err := NewClient(ClientConfig{})
7529 if err != nil {
7530 logError(testName, function, nil, startTime, "", "MinIO client object creation failed", err)
7531 return
7532 }
7533
7534 // Generate a new random bucket name.
7535 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
7536
7537 // Make a new bucket.
7538 function = "MakeBucket(bucketName, region)"
7539 functionAll = "MakeBucket(bucketName, region)"
7540 args["bucketName"] = bucketName
7541 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1"})
7542
7543 defer cleanupBucket(bucketName, c)
7544 if err != nil {
7545 logError(testName, function, args, startTime, "", "MakeBucket failed", err)
7546 return
7547 }
7548
7549 // Generate a random file name.
7550 fileName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
7551 file, err := os.Create(fileName)
7552 if err != nil {
7553 logError(testName, function, args, startTime, "", "File creation failed", err)
7554 return
7555 }
7556 for i := 0; i < 3; i++ {
7557 buf := make([]byte, rand.Intn(1<<19))
7558 _, err = file.Write(buf)
7559 if err != nil {
7560 logError(testName, function, args, startTime, "", "File write failed", err)
7561 return
7562 }
7563 }
7564 file.Close()
7565
7566 // Verify if bucket exits and you have access.
7567 var exists bool
7568 function = "BucketExists(bucketName)"
7569 functionAll += ", " + function
7570 args = map[string]interface{}{
7571 "bucketName": bucketName,
7572 }
7573 exists, err = c.BucketExists(context.Background(), bucketName)
7574 if err != nil {
7575 logError(testName, function, args, startTime, "", "BucketExists failed", err)
7576 return
7577 }

Callers 1

mainFunction · 0.85

Calls 15

MakeBucketMethod · 0.95
BucketExistsMethod · 0.95
GetBucketPolicyMethod · 0.95
SetBucketPolicyMethod · 0.95
ListBucketsMethod · 0.95
PutObjectMethod · 0.95
ListObjectsMethod · 0.95
ListIncompleteUploadsMethod · 0.95
GetObjectMethod · 0.95
FGetObjectMethod · 0.95
PresignedHeadObjectMethod · 0.95
PresignedGetObjectMethod · 0.95

Tested by

no test coverage detected