mirror of
https://github.com/pgsty/minio.git
synced 2026-08-10 16:23:28 +03:00
Move to latest release of minio-go (#4886)
- Region handling can now use region endpoints directly. - All uploads are streaming no more large buffer needed. - Major API overhaul for CopyObject(dst, src) - Fixes bugs present in existing code for copying - metadata replace directive CopyObject - PutObjectPart doesn't require md5Sum and sha256
This commit is contained in:
committed by
Dee Koder
parent
72490bf8db
commit
cf479eb401
@@ -15,3 +15,44 @@
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Tests extracting md5/sha256 bytes.
|
||||
func TestGetMD5AndSha256Bytes(t *testing.T) {
|
||||
testCases := []struct {
|
||||
md5Hex string
|
||||
sha256Hex string
|
||||
success bool
|
||||
}{
|
||||
// Test 1: Hex encoding failure.
|
||||
{
|
||||
md5Hex: "a",
|
||||
sha256Hex: "b",
|
||||
success: false,
|
||||
},
|
||||
// Test 2: Hex encoding success.
|
||||
{
|
||||
md5Hex: "91be0b892e47ede9de06aac14ca0369e",
|
||||
sha256Hex: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
success: true,
|
||||
},
|
||||
// Test 3: hex values are empty should return success.
|
||||
{
|
||||
md5Hex: "",
|
||||
sha256Hex: "",
|
||||
success: true,
|
||||
},
|
||||
}
|
||||
for i, testCase := range testCases {
|
||||
_, _, err := getMD5AndSha256SumBytes(testCase.md5Hex, testCase.sha256Hex)
|
||||
if err != nil && testCase.success {
|
||||
t.Errorf("Test %d: Expected success, but got failure %s", i+1, err)
|
||||
}
|
||||
if err == nil && !testCase.success {
|
||||
t.Errorf("Test %d: Expected failure, but got success", i+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user