S3: Add RequestTimeout in unittest.

This commit is contained in:
Zhang Huangbin
2023-09-05 17:34:55 +08:00
parent ae41d2f5c1
commit e735c69371
4 changed files with 9 additions and 5 deletions

View File

@@ -74,7 +74,7 @@ err := store.Set("my-key", []byte("my-value"))
Or, call `SetWithChecksum()` to create an object with checksum to Or, call `SetWithChecksum()` to create an object with checksum to
ask S3 server to verify data integrity on server side: ask S3 server to verify data integrity on server side:
> Currently 4 algorithm are supported: > Currently 4 algorithms are supported:
> - types.ChecksumAlgorithmCrc32 (`CRC32`) > - types.ChecksumAlgorithmCrc32 (`CRC32`)
> - types.ChecksumAlgorithmCrc32c (`CRC32C`) > - types.ChecksumAlgorithmCrc32c (`CRC32C`)
> - types.ChecksumAlgorithmSha1 (`SHA1`) > - types.ChecksumAlgorithmSha1 (`SHA1`)

View File

@@ -1,5 +1,9 @@
package s3 package s3
import (
"time"
)
var testStore *Storage var testStore *Storage
func init() { func init() {
@@ -12,7 +16,7 @@ func init() {
AccessKey: "minioadmin", AccessKey: "minioadmin",
SecretAccessKey: "minioadmin", SecretAccessKey: "minioadmin",
}, },
RequestTimeout: 10 * time.Second,
}, },
) )
} }

View File

@@ -12,8 +12,8 @@ import (
// Additional methods for S3, but not required by gofiber Storage interface. // Additional methods for S3, but not required by gofiber Storage interface.
// SetWithChecksum sets key with value and checksum. // SetWithChecksum sets key with value and checksum.
// Key of `checksum` map is algorithm in upper cases, value is the checksum. //
// Currently only 4 algorithm are supported: // Currently 4 algorithms are supported:
// - types.ChecksumAlgorithmCrc32 (`CRC32`) // - types.ChecksumAlgorithmCrc32 (`CRC32`)
// - types.ChecksumAlgorithmCrc32c (`CRC32C`) // - types.ChecksumAlgorithmCrc32c (`CRC32C`)
// - types.ChecksumAlgorithmSha1 (`SHA1`) // - types.ChecksumAlgorithmSha1 (`SHA1`)

View File

@@ -10,7 +10,7 @@ import (
func Test_S3_SetWithChecksum(t *testing.T) { func Test_S3_SetWithChecksum(t *testing.T) {
var ( var (
key = "john" key = "set-with-checksum"
val = []byte("doe") val = []byte("doe")
sha256sum = sha256.New().Sum(val) sha256sum = sha256.New().Sum(val)
checksum = map[types.ChecksumAlgorithm][]byte{ checksum = map[types.ChecksumAlgorithm][]byte{