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

Function testFunctionalV2

functional_tests.go:12479–12913  ·  view source on GitHub ↗

Tests comprehensive list of all methods.

()

Source from the content-addressed store, hash-verified

12477
12478// Tests comprehensive list of all methods.
12479func testFunctionalV2() {
12480 // initialize logging params
12481 startTime := time.Now()
12482 testName := getFuncName()
12483 function := "testFunctionalV2()"
12484 functionAll := ""
12485 args := map[string]interface{}{}
12486
12487 c, err := NewClient(ClientConfig{CredsV2: true})
12488 if err != nil {
12489 logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err)
12490 return
12491 }
12492
12493 // Generate a new random bucket name.
12494 bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-")
12495 location := "us-east-1"
12496 // Make a new bucket.
12497 function = "MakeBucket(bucketName, location)"
12498 functionAll = "MakeBucket(bucketName, location)"
12499 args = map[string]interface{}{
12500 "bucketName": bucketName,
12501 "location": location,
12502 }
12503 err = c.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: location})
12504 if err != nil {
12505 logError(testName, function, args, startTime, "", "MakeBucket failed", err)
12506 return
12507 }
12508
12509 defer cleanupBucket(bucketName, c)
12510
12511 // Generate a random file name.
12512 fileName := randString(60, rand.NewSource(time.Now().UnixNano()), "")
12513 file, err := os.Create(fileName)
12514 if err != nil {
12515 logError(testName, function, args, startTime, "", "file create failed", err)
12516 return
12517 }
12518 for i := 0; i < 3; i++ {
12519 buf := make([]byte, rand.Intn(1<<19))
12520 _, err = file.Write(buf)
12521 if err != nil {
12522 logError(testName, function, args, startTime, "", "file write failed", err)
12523 return
12524 }
12525 }
12526 file.Close()
12527
12528 // Verify if bucket exits and you have access.
12529 var exists bool
12530 function = "BucketExists(bucketName)"
12531 functionAll += ", " + function
12532 args = map[string]interface{}{
12533 "bucketName": bucketName,
12534 }
12535 exists, err = c.BucketExists(context.Background(), bucketName)
12536 if err != nil {

Callers 1

mainFunction · 0.85

Calls 15

MakeBucketMethod · 0.95
BucketExistsMethod · 0.95
SetBucketPolicyMethod · 0.95
ListBucketsMethod · 0.95
PutObjectMethod · 0.95
StatObjectMethod · 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