From 76a41461fe5124fb9b646615c6abafcd1d41c7c2 Mon Sep 17 00:00:00 2001 From: Sveinn Date: Mon, 8 Jan 2024 19:18:53 +0000 Subject: [PATCH] NEW API: GetObjectAttributes (#1921) --- api-get-object-attributes.go | 201 ++++++ constants.go | 20 + docs/API.md | 56 +- functional_tests.go | 1233 ++++++++++++++++++++++++++-------- utils.go | 1 + 5 files changed, 1230 insertions(+), 281 deletions(-) create mode 100644 api-get-object-attributes.go diff --git a/api-get-object-attributes.go b/api-get-object-attributes.go new file mode 100644 index 000000000..e1155c372 --- /dev/null +++ b/api-get-object-attributes.go @@ -0,0 +1,201 @@ +/* + * MinIO Go Library for Amazon S3 Compatible Cloud Storage + * Copyright 2020 MinIO, Inc. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package minio + +import ( + "context" + "encoding/xml" + "errors" + "net/http" + "net/url" + "strconv" + "time" + + "github.com/minio/minio-go/v7/pkg/encrypt" + "github.com/minio/minio-go/v7/pkg/s3utils" +) + +// ObjectAttributesOptions are options used for the GetObjectAttributes API +// +// - MaxParts +// How many parts the caller wants to be returned (default: 1000) +// +// - VersionID +// The object version you want to attributes for +// +// - PartNumberMarker +// the listing will start AFTER the part matching PartNumberMarker +// +// - ServerSideEncryption +// The server-side encryption algorithm used when storing this object in Minio +type ObjectAttributesOptions struct { + MaxParts int + VersionID string + PartNumberMarker int + ServerSideEncryption encrypt.ServerSide +} + +// ObjectAttributes is the response object returned by the GetObjectAttributes API +// +// - VersionID +// The object version +// +// - LastModified +// The last time the object was modified +// +// - ObjectAttributesResponse +// Contains more information about the object +type ObjectAttributes struct { + VersionID string + LastModified time.Time + ObjectAttributesResponse +} + +// ObjectAttributesResponse contains details returned by the GetObjectAttributes API +// +// Noteworthy fields: +// +// - ObjectParts.PartsCount +// Contains the total part count for the object (not the current response) +// +// - ObjectParts.PartNumberMarker +// Pagination of parts will begin at (but not include) PartNumberMarker +// +// - ObjectParts.NextPartNumberMarket +// The next PartNumberMarker to be used in order to continue pagination +// +// - ObjectParts.IsTruncated +// Indicates if the last part is included in the request (does not check if parts are missing from the start of the list, ONLY the end) +// +// - ObjectParts.MaxParts +// Reflects the MaxParts used by the caller or the default MaxParts value of the API +type ObjectAttributesResponse struct { + ETag string `xml:",omitempty"` + StorageClass string + ObjectSize int + Checksum struct { + ChecksumCRC32 string `xml:",omitempty"` + ChecksumCRC32C string `xml:",omitempty"` + ChecksumSHA1 string `xml:",omitempty"` + ChecksumSHA256 string `xml:",omitempty"` + } + ObjectParts struct { + PartsCount int + PartNumberMarker int + NextPartNumberMarker int + MaxParts int + IsTruncated bool + Parts []*ObjectAttributePart `xml:"Part"` + } +} + +// ObjectAttributePart is used by ObjectAttributesResponse to describe an object part +type ObjectAttributePart struct { + ChecksumCRC32 string `xml:",omitempty"` + ChecksumCRC32C string `xml:",omitempty"` + ChecksumSHA1 string `xml:",omitempty"` + ChecksumSHA256 string `xml:",omitempty"` + PartNumber int + Size int +} + +func (o *ObjectAttributes) parseResponse(resp *http.Response) (err error) { + mod, err := parseRFC7231Time(resp.Header.Get("Last-Modified")) + if err != nil { + return err + } + o.LastModified = mod + o.VersionID = resp.Header.Get(amzVersionID) + + response := new(ObjectAttributesResponse) + if err := xml.NewDecoder(resp.Body).Decode(response); err != nil { + return err + } + o.ObjectAttributesResponse = *response + + return +} + +// GetObjectAttributes API combines HeadObject and ListParts. +// More details on usage can be found in the documentation for ObjectAttributesOptions{} +func (c *Client) GetObjectAttributes(ctx context.Context, bucketName, objectName string, opts ObjectAttributesOptions) (*ObjectAttributes, error) { + if err := s3utils.CheckValidBucketName(bucketName); err != nil { + return nil, err + } + + if err := s3utils.CheckValidObjectName(objectName); err != nil { + return nil, err + } + + urlValues := make(url.Values) + urlValues.Add("attributes", "") + if opts.VersionID != "" { + urlValues.Add("versionId", opts.VersionID) + } + + headers := make(http.Header) + headers.Set(amzObjectAttributes, GetObjectAttributesTags) + + if opts.PartNumberMarker > 0 { + headers.Set(amzPartNumberMarker, strconv.Itoa(opts.PartNumberMarker)) + } + + if opts.MaxParts > 0 { + headers.Set(amzMaxParts, strconv.Itoa(opts.MaxParts)) + } else { + headers.Set(amzMaxParts, strconv.Itoa(GetObjectAttributesMaxParts)) + } + + if opts.ServerSideEncryption != nil { + opts.ServerSideEncryption.Marshal(headers) + } + + resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{ + bucketName: bucketName, + objectName: objectName, + queryValues: urlValues, + contentSHA256Hex: emptySHA256Hex, + customHeader: headers, + }) + if err != nil { + return nil, err + } + + defer closeResponse(resp) + + hasEtag := resp.Header.Get(ETag) + if hasEtag != "" { + return nil, errors.New("getObjectAttributes is not supported by the current endpoint version") + } + + if resp.StatusCode != http.StatusOK { + ER := new(ErrorResponse) + if err := xml.NewDecoder(resp.Body).Decode(ER); err != nil { + return nil, err + } + + return nil, *ER + } + + OA := new(ObjectAttributes) + err = OA.parseResponse(resp) + if err != nil { + return nil, err + } + + return OA, nil +} diff --git a/constants.go b/constants.go index 401d2a74d..4099a37f9 100644 --- a/constants.go +++ b/constants.go @@ -60,12 +60,32 @@ const ( ) const ( + // GetObjectAttributesTags are tags used to defined + // return values for the GetObjectAttributes API + GetObjectAttributesTags = "ETag,Checksum,StorageClass,ObjectSize,ObjectParts" + // GetObjectAttributesMaxParts defined the default maximum + // number of parts returned by GetObjectAttributes + GetObjectAttributesMaxParts = 1000 +) + +const ( + // Response Headers + + // ETag is a common response header + ETag = "ETag" + // Storage class header. amzStorageClass = "X-Amz-Storage-Class" // Website redirect location header amzWebsiteRedirectLocation = "X-Amz-Website-Redirect-Location" + // GetObjectAttributes headers + amzPartNumberMarker = "X-Amz-Part-Number-Marker" + amzExpectedBucketOnwer = "X-Amz-Expected-Bucket-Owner" + amzMaxParts = "X-Amz-Max-Parts" + amzObjectAttributes = "X-Amz-Object-Attributes" + // Object Tagging headers amzTaggingHeader = "X-Amz-Tagging" amzTaggingHeaderDirective = "X-Amz-Tagging-Directive" diff --git a/docs/API.md b/docs/API.md index 4fa6d3f7b..0e6fac7d2 100644 --- a/docs/API.md +++ b/docs/API.md @@ -81,6 +81,7 @@ func main() { | | [`GetObjectTagging`](#GetObjectTagging) | | | | | | [`RemoveObjectTagging`](#RemoveObjectTagging) | | | | | | [`RestoreObject`](#RestoreObject) | | | | +| | [`GetObjectAttributes`](#GetObjectAttributes) | | | | ## 1. Constructor @@ -445,8 +446,8 @@ __minio.GetObjectOptions__ |:---|:---|:---| | `opts.ServerSideEncryption` | _encrypt.ServerSide_ | Interface provided by `encrypt` package to specify server-side-encryption. (For more information see https://godoc.org/github.com/minio/minio-go/v7) | | `opts.Internal` | _minio.AdvancedGetOptions_ | This option is intended for internal use by MinIO server. This option should not be set unless the application is aware of intended use. -__Return Value__ +__Return Value__ |Param |Type |Description | |:---|:---| :---| @@ -1194,6 +1195,59 @@ if err != nil { } ``` + +### GetObjectAttributes(ctx context.Context, bucketName, objectName string, opts ObjectAttributesOptions) (*ObjectAttributes, error) +Returns a stream of the object data. Most of the common errors occur when reading the stream. + + +__Parameters__ + + +|Param |Type |Description | +|:---|:---| :---| +|`ctx` | _context.Context_ | Custom context for timeout/cancellation of the call| +|`bucketName` | _string_ |Name of the bucket | +|`objectName` | _string_ |Name of the object | +|`opts` | _minio.ObjectAttributesOptions_ | Configuration for pagination and selection of object attributes | + + +__minio.ObjectAttributesOptions__ + +|Field | Type | Description | +|:---|:---|:---| +| `opts.ServerSideEncryption` | _encrypt.ServerSide_ | Interface provided by `encrypt` package to specify server-side-encryption. (For more information see https://godoc.org/github.com/minio/minio-go/v7) | +| `opts.MaxParts` | _int | This option defines how many parts should be returned by the API +| `opts.VersionID` | _string | VersionID defines which version of the object will be used +| `opts.PartNumberMarker` | _int | This options defines which part number pagination will start after, the part which number is equal to PartNumberMarker will not be included in the response + +__Return Value__ + +|Param |Type |Description | +|:---|:---| :---| +|`objectAttributes` | _*minio.ObjectAttributes_ |_minio.ObjectAttributes_ contains the information about the object and it's parts. | + +__Example__ + + +```go +objectAttributes, err := c.GetObjectAttributes( + context.Background(), + "your-bucket", + "your-object", + minio.ObjectAttributesOptions{ + VersionID:"object-version-id", + NextPartMarker:0, + MaxParts:100, + }) + +if err != nil { + fmt.Println(err) + return +} + +fmt.Println(objectAttributes) +``` + ### RemoveIncompleteUpload(ctx context.Context, bucketName, objectName string) error diff --git a/functional_tests.go b/functional_tests.go index f951cd073..a6a436c23 100644 --- a/functional_tests.go +++ b/functional_tests.go @@ -47,6 +47,7 @@ import ( "time" "github.com/dustin/go-humanize" + "github.com/google/uuid" jsoniter "github.com/json-iterator/go" "github.com/minio/sha256-simd" log "github.com/sirupsen/logrus" @@ -66,13 +67,30 @@ const ( ) const ( - serverEndpoint = "SERVER_ENDPOINT" - accessKey = "ACCESS_KEY" - secretKey = "SECRET_KEY" - enableHTTPS = "ENABLE_HTTPS" - enableKMS = "ENABLE_KMS" + serverEndpoint = "SERVER_ENDPOINT" + accessKey = "ACCESS_KEY" + secretKey = "SECRET_KEY" + enableHTTPS = "ENABLE_HTTPS" + enableKMS = "ENABLE_KMS" + appVersion = "0.1.0" + skipCERTValidation = "SKIP_CERT_VALIDATION" ) +func createHTTPTransport() (transport *http.Transport) { + var err error + transport, err = minio.DefaultTransport(mustParseBool(os.Getenv(enableHTTPS))) + if err != nil { + logError("http-transport", getFuncName(), nil, time.Now(), "", "could not create http transport", err) + return nil + } + + if mustParseBool(os.Getenv(skipCERTValidation)) { + transport.TLSClientConfig.InsecureSkipVerify = true + } + + return +} + type mintJSONFormatter struct{} func (f *mintJSONFormatter) Format(entry *log.Entry) ([]byte, error) { @@ -425,8 +443,9 @@ func testMakeBucketError() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + Transport: createHTTPTransport(), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client creation failed", err) @@ -437,7 +456,7 @@ func testMakeBucketError() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -478,14 +497,15 @@ func testMetadataSizeLimit() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + Transport: createHTTPTransport(), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client creation failed", err) return } - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") args["bucketName"] = bucketName @@ -547,8 +567,9 @@ func testMakeBucketRegions() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client creation failed", err) @@ -559,7 +580,7 @@ func testMakeBucketRegions() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -613,8 +634,9 @@ func testPutObjectReadAt() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -625,7 +647,7 @@ func testPutObjectReadAt() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -711,8 +733,9 @@ func testListObjectVersions() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -723,7 +746,7 @@ func testListObjectVersions() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -830,8 +853,9 @@ func testStatObjectWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -842,7 +866,7 @@ func testStatObjectWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -947,8 +971,9 @@ func testGetObjectWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -959,7 +984,7 @@ func testGetObjectWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -1086,8 +1111,9 @@ func testPutObjectWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -1098,7 +1124,7 @@ func testPutObjectWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -1233,8 +1259,9 @@ func testCopyObjectWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -1245,7 +1272,7 @@ func testCopyObjectWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -1370,8 +1397,9 @@ func testConcurrentCopyObjectWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -1382,7 +1410,7 @@ func testConcurrentCopyObjectWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -1530,8 +1558,9 @@ func testComposeObjectWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -1542,7 +1571,7 @@ func testComposeObjectWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -1670,8 +1699,9 @@ func testRemoveObjectWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -1682,7 +1712,7 @@ func testRemoveObjectWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -1782,8 +1812,9 @@ func testRemoveObjectsWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -1794,7 +1825,7 @@ func testRemoveObjectsWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -1877,8 +1908,9 @@ func testObjectTaggingWithVersioning() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -1889,7 +1921,7 @@ func testObjectTaggingWithVersioning() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -2044,8 +2076,9 @@ func testPutObjectWithChecksums() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -2056,7 +2089,7 @@ func testPutObjectWithChecksums() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -2238,8 +2271,9 @@ func testPutMultipartObjectWithChecksums() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -2250,7 +2284,7 @@ func testPutMultipartObjectWithChecksums() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -2408,6 +2442,7 @@ func testTrailingChecksums() { c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), Secure: mustParseBool(os.Getenv(enableHTTPS)), TrailingHeaders: true, }) @@ -2420,7 +2455,7 @@ func testTrailingChecksums() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -2621,6 +2656,7 @@ func testPutObjectWithAutomaticChecksums() { c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), Secure: mustParseBool(os.Getenv(enableHTTPS)), TrailingHeaders: true, }) @@ -2630,7 +2666,7 @@ func testPutObjectWithAutomaticChecksums() { } // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -2754,6 +2790,558 @@ func testPutObjectWithAutomaticChecksums() { successLogger(testName, function, args, startTime).Info() } +func testGetObjectAttributes() { + startTime := time.Now() + testName := getFuncName() + function := "GetObjectAttributes(ctx, bucketName, objectName, opts)" + args := map[string]interface{}{ + "bucketName": "", + "objectName": "", + "opts": "minio.ObjectAttributesOptions{}", + } + + if !isFullMode() { + ignoredLog(testName, function, args, startTime, "Skipping functional tests for short/quick runs").Info() + return + } + + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + TrailingHeaders: true, + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) + return + } + + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + + bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + args["bucketName"] = bucketName + err = c.MakeBucket( + context.Background(), + bucketName, + minio.MakeBucketOptions{Region: "us-east-1"}, + ) + if err != nil { + logError(testName, function, args, startTime, "", "Make bucket failed", err) + return + } + + bucketNameV := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-versioned-") + args["bucketName"] = bucketNameV + err = c.MakeBucket( + context.Background(), + bucketNameV, + minio.MakeBucketOptions{Region: "us-east-1"}, + ) + if err != nil { + logError(testName, function, args, startTime, "", "Make bucket failed", err) + return + } + err = c.EnableVersioning(context.Background(), bucketNameV) + if err != nil { + logError(testName, function, args, startTime, "", "Unable to enable versioning", err) + return + } + + defer cleanupBucket(bucketName, c) + defer cleanupVersionedBucket(bucketNameV, c) + + testFiles := make(map[string]*objectAttributesNewObject) + testFiles["file1"] = &objectAttributesNewObject{ + Object: "file1", + ObjectReaderType: "datafile-1.03-MB", + Bucket: bucketNameV, + ContentType: "custom/contenttype", + SendContentMd5: false, + } + + testFiles["file2"] = &objectAttributesNewObject{ + Object: "file2", + ObjectReaderType: "datafile-129-MB", + Bucket: bucketName, + ContentType: "custom/contenttype", + SendContentMd5: false, + } + + for i, v := range testFiles { + bufSize := dataFileMap[v.ObjectReaderType] + + reader := getDataReader(v.ObjectReaderType) + + args["objectName"] = v.Object + testFiles[i].UploadInfo, err = c.PutObject(context.Background(), v.Bucket, v.Object, reader, int64(bufSize), minio.PutObjectOptions{ + ContentType: v.ContentType, + SendContentMd5: v.SendContentMd5, + }) + + if err != nil { + logError(testName, function, args, startTime, "", "PutObject failed", err) + return + } + } + + testTable := make(map[string]objectAttributesTableTest) + + testTable["none-versioned"] = objectAttributesTableTest{ + opts: minio.ObjectAttributesOptions{}, + test: objectAttributesTestOptions{ + TestFileName: "file2", + StorageClass: "STANDARD", + HasFullChecksum: true, + HasPartChecksums: true, + HasParts: true, + }, + } + + testTable["0-to-0-marker"] = objectAttributesTableTest{ + opts: minio.ObjectAttributesOptions{ + PartNumberMarker: 0, + MaxParts: 0, + }, + test: objectAttributesTestOptions{ + TestFileName: "file2", + StorageClass: "STANDARD", + HasFullChecksum: true, + HasPartChecksums: true, + HasParts: true, + }, + } + + testTable["0-marker-to-max"] = objectAttributesTableTest{ + opts: minio.ObjectAttributesOptions{ + PartNumberMarker: 0, + MaxParts: 10000, + }, + test: objectAttributesTestOptions{ + TestFileName: "file2", + StorageClass: "STANDARD", + HasFullChecksum: true, + HasPartChecksums: true, + HasParts: true, + }, + } + + testTable["0-to-1-marker"] = objectAttributesTableTest{ + opts: minio.ObjectAttributesOptions{ + PartNumberMarker: 0, + MaxParts: 1, + }, + test: objectAttributesTestOptions{ + TestFileName: "file2", + StorageClass: "STANDARD", + HasFullChecksum: true, + HasPartChecksums: true, + HasParts: true, + }, + } + + testTable["7-to-6-marker"] = objectAttributesTableTest{ + opts: minio.ObjectAttributesOptions{ + PartNumberMarker: 7, + MaxParts: 6, + }, + test: objectAttributesTestOptions{ + TestFileName: "file2", + StorageClass: "STANDARD", + HasFullChecksum: true, + HasPartChecksums: true, + HasParts: true, + }, + } + + testTable["versioned"] = objectAttributesTableTest{ + opts: minio.ObjectAttributesOptions{}, + test: objectAttributesTestOptions{ + TestFileName: "file1", + StorageClass: "STANDARD", + HasFullChecksum: false, + }, + } + + for i, v := range testTable { + + tf, ok := testFiles[v.test.TestFileName] + if !ok { + continue + } + + args["objectName"] = tf.Object + args["bucketName"] = tf.Bucket + if tf.UploadInfo.VersionID != "" { + v.opts.VersionID = tf.UploadInfo.VersionID + } + + s, err := c.GetObjectAttributes(context.Background(), tf.Bucket, tf.Object, v.opts) + if err != nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes failed", err) + return + } + + v.test.NumberOfParts = s.ObjectParts.PartsCount + v.test.ETag = tf.UploadInfo.ETag + v.test.ObjectSize = int(tf.UploadInfo.Size) + + err = validateObjectAttributeRequest(s, &v.opts, &v.test) + if err != nil { + logError(testName, function, args, startTime, "", "Validating GetObjectsAttributes response failed, table test: "+i, err) + return + } + + } + + successLogger(testName, function, args, startTime).Info() +} + +func testGetObjectAttributesSSECEncryption() { + startTime := time.Now() + testName := getFuncName() + function := "GetObjectAttributes(ctx, bucketName, objectName, opts)" + args := map[string]interface{}{ + "bucketName": "", + "objectName": "", + "opts": "minio.ObjectAttributesOptions{}", + } + + if !isFullMode() { + ignoredLog(testName, function, args, startTime, "Skipping functional tests for short/quick runs").Info() + return + } + + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + TrailingHeaders: true, + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + Transport: createHTTPTransport(), + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) + return + } + + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + args["bucketName"] = bucketName + err = c.MakeBucket( + context.Background(), + bucketName, + minio.MakeBucketOptions{Region: "us-east-1"}, + ) + if err != nil { + logError(testName, function, args, startTime, "", "Make bucket failed", err) + return + } + + defer cleanupBucket(bucketName, c) + + objectName := "encrypted-object" + args["objectName"] = objectName + bufSize := dataFileMap["datafile-11-MB"] + reader := getDataReader("datafile-11-MB") + + sse := encrypt.DefaultPBKDF([]byte("word1 word2 word3 word4"), []byte(bucketName+objectName)) + + info, err := c.PutObject(context.Background(), bucketName, objectName, reader, int64(bufSize), minio.PutObjectOptions{ + ContentType: "content/custom", + SendContentMd5: true, + ServerSideEncryption: sse, + PartSize: uint64(bufSize) / 2, + }) + if err != nil { + logError(testName, function, args, startTime, "", "PutObject failed", err) + return + } + + opts := minio.ObjectAttributesOptions{ + ServerSideEncryption: sse, + } + attr, err := c.GetObjectAttributes(context.Background(), bucketName, objectName, opts) + if err != nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes with empty bucket name should have failed", nil) + return + } + err = validateObjectAttributeRequest(attr, &opts, &objectAttributesTestOptions{ + TestFileName: info.Key, + ETag: info.ETag, + NumberOfParts: 2, + ObjectSize: int(info.Size), + HasFullChecksum: false, + HasParts: true, + HasPartChecksums: false, + }) + if err != nil { + logError(testName, function, args, startTime, "", "Validating GetObjectsAttributes response failed", err) + return + } + + successLogger(testName, function, args, startTime).Info() +} + +func testGetObjectAttributesErrorCases() { + startTime := time.Now() + testName := getFuncName() + function := "GetObjectAttributes(ctx, bucketName, objectName, opts)" + args := map[string]interface{}{ + "bucketName": "", + "objectName": "", + "opts": "minio.ObjectAttributesOptions{}", + } + + if !isFullMode() { + ignoredLog(testName, function, args, startTime, "Skipping functional tests for short/quick runs").Info() + return + } + + c, err := minio.New(os.Getenv(serverEndpoint), + &minio.Options{ + TrailingHeaders: true, + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + }) + if err != nil { + logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) + return + } + + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) + unknownBucket := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-bucket-") + unknownObject := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-object-") + + _, err = c.GetObjectAttributes(context.Background(), unknownBucket, unknownObject, minio.ObjectAttributesOptions{}) + if err == nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes failed", nil) + return + } + + errorResponse := err.(minio.ErrorResponse) + if errorResponse.Code != "NoSuchBucket" { + logError(testName, function, args, startTime, "", "Invalid error code, expected NoSuchBucket but got "+errorResponse.Code, nil) + return + } + + bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") + args["bucketName"] = bucketName + err = c.MakeBucket( + context.Background(), + bucketName, + minio.MakeBucketOptions{Region: "us-east-1"}, + ) + if err != nil { + logError(testName, function, args, startTime, "", "Make bucket failed", err) + return + } + + bucketNameV := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-versioned-") + args["bucketName"] = bucketNameV + err = c.MakeBucket( + context.Background(), + bucketNameV, + minio.MakeBucketOptions{Region: "us-east-1"}, + ) + if err != nil { + logError(testName, function, args, startTime, "", "Make bucket failed", err) + return + } + err = c.EnableVersioning(context.Background(), bucketNameV) + if err != nil { + logError(testName, function, args, startTime, "", "Make bucket failed", err) + return + } + defer cleanupBucket(bucketName, c) + defer cleanupVersionedBucket(bucketNameV, c) + + _, err = c.GetObjectAttributes(context.Background(), bucketName, unknownObject, minio.ObjectAttributesOptions{}) + if err == nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes failed", nil) + return + } + + errorResponse = err.(minio.ErrorResponse) + if errorResponse.Code != "NoSuchKey" { + logError(testName, function, args, startTime, "", "Invalid error code, expected NoSuchKey but got "+errorResponse.Code, nil) + return + } + + _, err = c.GetObjectAttributes(context.Background(), bucketName, "", minio.ObjectAttributesOptions{}) + if err == nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes with empty object name should have failed", nil) + return + } + + _, err = c.GetObjectAttributes(context.Background(), "", unknownObject, minio.ObjectAttributesOptions{}) + if err == nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes with empty bucket name should have failed", nil) + return + } + + _, err = c.GetObjectAttributes(context.Background(), bucketNameV, unknownObject, minio.ObjectAttributesOptions{ + VersionID: uuid.NewString(), + }) + if err == nil { + logError(testName, function, args, startTime, "", "GetObjectAttributes with empty bucket name should have failed", nil) + return + } + errorResponse = err.(minio.ErrorResponse) + if errorResponse.Code != "NoSuchVersion" { + logError(testName, function, args, startTime, "", "Invalid error code, expected NoSuchVersion but got "+errorResponse.Code, nil) + return + } + + successLogger(testName, function, args, startTime).Info() +} + +type objectAttributesNewObject struct { + Object string + ObjectReaderType string + Bucket string + ContentType string + SendContentMd5 bool + UploadInfo minio.UploadInfo +} + +type objectAttributesTableTest struct { + opts minio.ObjectAttributesOptions + test objectAttributesTestOptions +} + +type objectAttributesTestOptions struct { + TestFileName string + ETag string + NumberOfParts int + StorageClass string + ObjectSize int + HasPartChecksums bool + HasFullChecksum bool + HasParts bool +} + +func validateObjectAttributeRequest(OA *minio.ObjectAttributes, opts *minio.ObjectAttributesOptions, test *objectAttributesTestOptions) (err error) { + if opts.VersionID != "" { + if OA.VersionID != opts.VersionID { + err = fmt.Errorf("Expected versionId %s but got versionId %s", opts.VersionID, OA.VersionID) + return + } + } + + partsMissingChecksum := false + foundPartChecksum := false + for _, v := range OA.ObjectParts.Parts { + checksumFound := false + if v.ChecksumSHA256 != "" { + checksumFound = true + } else if v.ChecksumSHA1 != "" { + checksumFound = true + } else if v.ChecksumCRC32 != "" { + checksumFound = true + } else if v.ChecksumCRC32C != "" { + checksumFound = true + } + if !checksumFound { + partsMissingChecksum = true + } else { + foundPartChecksum = true + } + } + + if test.HasPartChecksums { + if partsMissingChecksum { + err = fmt.Errorf("One or all parts were missing a checksum") + return + } + } else { + if foundPartChecksum { + err = fmt.Errorf("Did not expect ObjectParts to have checksums but found one") + return + } + } + + hasFullObjectChecksum := true + if OA.Checksum.ChecksumCRC32 == "" { + if OA.Checksum.ChecksumCRC32C == "" { + if OA.Checksum.ChecksumSHA1 == "" { + if OA.Checksum.ChecksumSHA256 == "" { + hasFullObjectChecksum = false + } + } + } + } + + if test.HasFullChecksum { + if !hasFullObjectChecksum { + err = fmt.Errorf("Full object checksum not found") + return + } + } else { + if hasFullObjectChecksum { + err = fmt.Errorf("Did not expect a full object checksum but we got one") + return + } + } + + if OA.ETag != test.ETag { + err = fmt.Errorf("Etags do not match, got %s but expected %s", OA.ETag, test.ETag) + return + } + + if test.HasParts { + if len(OA.ObjectParts.Parts) < 1 { + err = fmt.Errorf("Was expecting ObjectParts but none were present") + return + } + } + + if OA.StorageClass == "" { + err = fmt.Errorf("Was expecting a StorageClass but got none") + return + } + + if OA.ObjectSize != test.ObjectSize { + err = fmt.Errorf("Was expecting a ObjectSize but got none") + return + } + + if test.HasParts { + if opts.MaxParts == 0 { + if len(OA.ObjectParts.Parts) != OA.ObjectParts.PartsCount { + err = fmt.Errorf("expected %s parts but got %d", OA.ObjectParts.PartsCount, len(OA.ObjectParts.Parts)) + return + } + } else if (opts.MaxParts + opts.PartNumberMarker) > OA.ObjectParts.PartsCount { + if len(OA.ObjectParts.Parts) != (OA.ObjectParts.PartsCount - opts.PartNumberMarker) { + err = fmt.Errorf("expected %d parts but got %d", (OA.ObjectParts.PartsCount - opts.PartNumberMarker), len(OA.ObjectParts.Parts)) + return + } + } else if opts.MaxParts != 0 { + if opts.MaxParts != len(OA.ObjectParts.Parts) { + err = fmt.Errorf("expected %d parts but got %d", opts.MaxParts, len(OA.ObjectParts.Parts)) + return + } + } + } + + if OA.ObjectParts.NextPartNumberMarker == OA.ObjectParts.PartsCount { + if OA.ObjectParts.IsTruncated { + err = fmt.Errorf("Expected ObjectParts to NOT be truncated, but it was") + return + } + } + + if OA.ObjectParts.NextPartNumberMarker != OA.ObjectParts.PartsCount { + if !OA.ObjectParts.IsTruncated { + err = fmt.Errorf("Expected ObjectParts to be truncated, but it was NOT") + return + } + } + + return +} + // Test PutObject using a large data to trigger multipart readat func testPutObjectWithMetadata() { // initialize logging params @@ -2777,8 +3365,9 @@ func testPutObjectWithMetadata() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -2789,7 +3378,7 @@ func testPutObjectWithMetadata() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -2883,8 +3472,9 @@ func testPutObjectWithContentLanguage() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -2895,7 +3485,7 @@ func testPutObjectWithContentLanguage() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -2952,8 +3542,9 @@ func testPutObjectStreaming() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -2964,7 +3555,7 @@ func testPutObjectStreaming() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -3023,8 +3614,9 @@ func testGetObjectSeekEnd() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3035,7 +3627,7 @@ func testGetObjectSeekEnd() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -3145,8 +3737,9 @@ func testGetObjectClosedTwice() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3157,7 +3750,7 @@ func testGetObjectClosedTwice() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -3235,8 +3828,9 @@ func testRemoveObjectsContext() { // Instantiate new minio client. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3244,7 +3838,7 @@ func testRemoveObjectsContext() { } // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Enable tracing, write to stdout. // c.TraceOn(os.Stderr) @@ -3331,8 +3925,9 @@ func testRemoveMultipleObjects() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3340,7 +3935,7 @@ func testRemoveMultipleObjects() { } // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Enable tracing, write to stdout. // c.TraceOn(os.Stderr) @@ -3414,8 +4009,9 @@ func testRemoveMultipleObjectsWithResult() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3423,7 +4019,7 @@ func testRemoveMultipleObjectsWithResult() { } // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Enable tracing, write to stdout. // c.TraceOn(os.Stderr) @@ -3549,8 +4145,9 @@ func testFPutObjectMultipart() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3561,7 +4158,7 @@ func testFPutObjectMultipart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -3654,8 +4251,9 @@ func testFPutObject() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3666,7 +4264,7 @@ func testFPutObject() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -3823,8 +4421,9 @@ func testFPutObjectContext() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3835,7 +4434,7 @@ func testFPutObjectContext() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -3923,8 +4522,9 @@ func testFPutObjectContextV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -3935,7 +4535,7 @@ func testFPutObjectContextV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -4024,8 +4624,9 @@ func testPutObjectContext() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -4036,7 +4637,7 @@ func testPutObjectContext() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Make a new bucket. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -4096,8 +4697,9 @@ func testGetObjectS3Zip() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -4108,7 +4710,7 @@ func testGetObjectS3Zip() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -4279,8 +4881,9 @@ func testGetObjectReadSeekFunctional() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -4291,7 +4894,7 @@ func testGetObjectReadSeekFunctional() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -4448,8 +5051,9 @@ func testGetObjectReadAtFunctional() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -4460,7 +5064,7 @@ func testGetObjectReadAtFunctional() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -4625,8 +5229,9 @@ func testGetObjectReadAtWhenEOFWasReached() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -4637,7 +5242,7 @@ func testGetObjectReadAtWhenEOFWasReached() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -4744,8 +5349,9 @@ func testPresignedPostPolicy() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -4756,7 +5362,7 @@ func testPresignedPostPolicy() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -4965,8 +5571,9 @@ func testCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -4977,7 +5584,7 @@ func testCopyObject() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -5159,8 +5766,9 @@ func testSSECEncryptedGetObjectReadSeekFunctional() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -5171,7 +5779,7 @@ func testSSECEncryptedGetObjectReadSeekFunctional() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -5341,8 +5949,9 @@ func testSSES3EncryptedGetObjectReadSeekFunctional() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -5353,7 +5962,7 @@ func testSSES3EncryptedGetObjectReadSeekFunctional() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -5521,8 +6130,9 @@ func testSSECEncryptedGetObjectReadAtFunctional() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -5533,7 +6143,7 @@ func testSSECEncryptedGetObjectReadAtFunctional() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -5704,8 +6314,9 @@ func testSSES3EncryptedGetObjectReadAtFunctional() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -5716,7 +6327,7 @@ func testSSES3EncryptedGetObjectReadAtFunctional() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -5888,8 +6499,9 @@ func testSSECEncryptionPutGet() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -5900,7 +6512,7 @@ func testSSECEncryptionPutGet() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -5997,8 +6609,9 @@ func testSSECEncryptionFPut() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -6009,7 +6622,7 @@ func testSSECEncryptionFPut() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -6119,8 +6732,9 @@ func testSSES3EncryptionPutGet() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -6131,7 +6745,7 @@ func testSSES3EncryptionPutGet() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -6226,8 +6840,9 @@ func testSSES3EncryptionFPut() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -6238,7 +6853,7 @@ func testSSES3EncryptionFPut() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -6353,8 +6968,9 @@ func testBucketNotification() { c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -6365,7 +6981,7 @@ func testBucketNotification() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) bucketName := os.Getenv("NOTIFY_BUCKET") args["bucketName"] = bucketName @@ -6447,8 +7063,9 @@ func testFunctional() { c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, nil, startTime, "", "MinIO client object creation failed", err) @@ -6459,7 +7076,7 @@ func testFunctional() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -7134,8 +7751,9 @@ func testGetObjectModified() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -7146,7 +7764,7 @@ func testGetObjectModified() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Make a new bucket. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -7229,8 +7847,9 @@ func testPutObjectUploadSeekedObject() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -7241,7 +7860,7 @@ func testPutObjectUploadSeekedObject() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Make a new bucket. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -7351,8 +7970,9 @@ func testMakeBucketErrorV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -7363,7 +7983,7 @@ func testMakeBucketErrorV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -7410,8 +8030,9 @@ func testGetObjectClosedTwiceV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -7422,7 +8043,7 @@ func testGetObjectClosedTwiceV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -7500,8 +8121,9 @@ func testFPutObjectV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -7512,7 +8134,7 @@ func testFPutObjectV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -7660,8 +8282,9 @@ func testMakeBucketRegionsV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -7672,7 +8295,7 @@ func testMakeBucketRegionsV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -7722,8 +8345,9 @@ func testGetObjectReadSeekFunctionalV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -7734,7 +8358,7 @@ func testGetObjectReadSeekFunctionalV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -7876,8 +8500,9 @@ func testGetObjectReadAtFunctionalV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -7888,7 +8513,7 @@ func testGetObjectReadAtFunctionalV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -8037,8 +8662,9 @@ func testCopyObjectV2() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8049,7 +8675,7 @@ func testCopyObjectV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -8252,8 +8878,9 @@ func testComposeObjectErrorCasesV2() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8349,8 +8976,9 @@ func testCompose10KSourcesV2() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8370,8 +8998,9 @@ func testEncryptedEmptyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -8630,8 +9259,9 @@ func testUnencryptedToSSECCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8656,8 +9286,9 @@ func testUnencryptedToSSES3CopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8683,8 +9314,9 @@ func testUnencryptedToUnencryptedCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8709,8 +9341,9 @@ func testEncryptedSSECToSSECCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8736,8 +9369,9 @@ func testEncryptedSSECToSSES3CopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8763,8 +9397,9 @@ func testEncryptedSSECToUnencryptedCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8790,8 +9425,9 @@ func testEncryptedSSES3ToSSECCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8817,8 +9453,9 @@ func testEncryptedSSES3ToSSES3CopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8844,8 +9481,9 @@ func testEncryptedSSES3ToUnencryptedCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8871,8 +9509,9 @@ func testEncryptedCopyObjectV2() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8897,8 +9536,9 @@ func testDecryptedCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v2 client object creation failed", err) @@ -8956,8 +9596,9 @@ func testSSECMultipartEncryptedToSSECCopyObjectPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -8971,7 +9612,7 @@ func testSSECMultipartEncryptedToSSECCopyObjectPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -9153,8 +9794,9 @@ func testSSECEncryptedToSSECCopyObjectPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -9168,7 +9810,7 @@ func testSSECEncryptedToSSECCopyObjectPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -9330,8 +9972,9 @@ func testSSECEncryptedToUnencryptedCopyPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -9345,7 +9988,7 @@ func testSSECEncryptedToUnencryptedCopyPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -9506,8 +10149,9 @@ func testSSECEncryptedToSSES3CopyObjectPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -9521,7 +10165,7 @@ func testSSECEncryptedToSSES3CopyObjectPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -9685,8 +10329,9 @@ func testUnencryptedToSSECCopyObjectPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -9700,7 +10345,7 @@ func testUnencryptedToSSECCopyObjectPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -9859,8 +10504,9 @@ func testUnencryptedToUnencryptedCopyPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -9874,7 +10520,7 @@ func testUnencryptedToUnencryptedCopyPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -10029,8 +10675,9 @@ func testUnencryptedToSSES3CopyObjectPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -10044,7 +10691,7 @@ func testUnencryptedToSSES3CopyObjectPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -10201,8 +10848,9 @@ func testSSES3EncryptedToSSECCopyObjectPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -10216,7 +10864,7 @@ func testSSES3EncryptedToSSECCopyObjectPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -10376,8 +11024,9 @@ func testSSES3EncryptedToUnencryptedCopyPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -10391,7 +11040,7 @@ func testSSES3EncryptedToUnencryptedCopyPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -10547,8 +11196,9 @@ func testSSES3EncryptedToSSES3CopyObjectPart() { // Instantiate new minio client object client, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -10562,7 +11212,7 @@ func testSSES3EncryptedToSSES3CopyObjectPart() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test") @@ -10720,8 +11370,9 @@ func testUserMetadataCopying() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -10896,8 +11547,9 @@ func testUserMetadataCopyingV2() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err) @@ -10918,8 +11570,9 @@ func testStorageClassMetadataPutObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -11005,8 +11658,9 @@ func testStorageClassInvalidMetadataPutObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -11047,8 +11701,9 @@ func testStorageClassMetadataCopyObject() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + Transport: createHTTPTransport(), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO v4 client object creation failed", err) @@ -11176,8 +11831,9 @@ func testPutObjectNoLengthV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err) @@ -11188,7 +11844,7 @@ func testPutObjectNoLengthV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -11251,8 +11907,9 @@ func testPutObjectsUnknownV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err) @@ -11263,7 +11920,7 @@ func testPutObjectsUnknownV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -11341,8 +11998,9 @@ func testPutObject0ByteV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err) @@ -11353,7 +12011,7 @@ func testPutObject0ByteV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -11402,8 +12060,9 @@ func testComposeObjectErrorCases() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -11424,8 +12083,9 @@ func testCompose10KSources() { // Instantiate new minio client object c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client object creation failed", err) @@ -11449,8 +12109,9 @@ func testFunctionalV2() { c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Secure: mustParseBool(os.Getenv(enableHTTPS)), + Transport: createHTTPTransport(), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err) @@ -11461,7 +12122,7 @@ func testFunctionalV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -11909,8 +12570,9 @@ func testGetObjectContext() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) @@ -11921,7 +12583,7 @@ func testGetObjectContext() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -12011,8 +12673,9 @@ func testFGetObjectContext() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) @@ -12023,7 +12686,7 @@ func testFGetObjectContext() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -12099,8 +12762,9 @@ func testGetObjectRanges() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) @@ -12111,7 +12775,7 @@ func testGetObjectRanges() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rng, "minio-go-test-") @@ -12208,8 +12872,9 @@ func testGetObjectACLContext() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) @@ -12220,7 +12885,7 @@ func testGetObjectACLContext() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -12383,8 +13048,9 @@ func testPutObjectContextV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err) @@ -12395,7 +13061,7 @@ func testPutObjectContextV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Make a new bucket. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -12457,8 +13123,9 @@ func testGetObjectContextV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err) @@ -12469,7 +13136,7 @@ func testGetObjectContextV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -12557,8 +13224,9 @@ func testFGetObjectContextV2() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV2(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v2 object creation failed", err) @@ -12569,7 +13237,7 @@ func testFGetObjectContextV2() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -12645,8 +13313,9 @@ func testListObjects() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) @@ -12657,7 +13326,7 @@ func testListObjects() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -12745,8 +13414,9 @@ func testRemoveObjects() { // Instantiate new minio client object. c, err := minio.New(os.Getenv(serverEndpoint), &minio.Options{ - Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), - Secure: mustParseBool(os.Getenv(enableHTTPS)), + Creds: credentials.NewStaticV4(os.Getenv(accessKey), os.Getenv(secretKey), ""), + Transport: createHTTPTransport(), + Secure: mustParseBool(os.Getenv(enableHTTPS)), }) if err != nil { logError(testName, function, args, startTime, "", "MinIO client v4 object creation failed", err) @@ -12757,7 +13427,7 @@ func testRemoveObjects() { // c.TraceOn(os.Stderr) // Set user agent. - c.SetAppInfo("MinIO-go-FunctionalTest", "0.1.0") + c.SetAppInfo("MinIO-go-FunctionalTest", appVersion) // Generate a new random bucket name. bucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "minio-go-test-") @@ -12891,6 +13561,8 @@ func main() { // execute tests if isFullMode() { + testGetObjectAttributes() + testGetObjectAttributesErrorCases() testMakeBucketErrorV2() testGetObjectClosedTwiceV2() testFPutObjectV2() @@ -12962,6 +13634,7 @@ func main() { // SSE-C tests will only work over TLS connection. if tls { + testGetObjectAttributesSSECEncryption() testSSECEncryptionPutGet() testSSECEncryptionFPut() testSSECEncryptedGetObjectReadAtFunctional() diff --git a/utils.go b/utils.go index 91eada0bf..94c19b2a5 100644 --- a/utils.go +++ b/utils.go @@ -514,6 +514,7 @@ func isAmzHeader(headerKey string) bool { // supportedQueryValues is a list of query strings that can be passed in when using GetObject. var supportedQueryValues = map[string]bool{ + "attributes": true, "partNumber": true, "versionId": true, "response-cache-control": true,