-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from peng225/multipart-upload
support multipart upload
- Loading branch information
Showing
12 changed files
with
311 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package argparser | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestParseMultipartThresh(t *testing.T) { | ||
type testCase struct { | ||
multipartThreshStr string | ||
expectedMultipartThresh int | ||
expectedErr bool | ||
} | ||
testCases := []testCase{ | ||
{ | ||
multipartThreshStr: "512", | ||
expectedMultipartThresh: 512, | ||
expectedErr: false, | ||
}, | ||
{ | ||
multipartThreshStr: "2k", | ||
expectedMultipartThresh: 2048, | ||
expectedErr: false, | ||
}, | ||
{ | ||
multipartThreshStr: "4m", | ||
expectedMultipartThresh: 4 * 1024 * 1024, | ||
expectedErr: false, | ||
}, | ||
{ | ||
multipartThreshStr: "12m", | ||
expectedMultipartThresh: 12 * 1024 * 1024, | ||
expectedErr: false, | ||
}, | ||
{ | ||
multipartThreshStr: "8g", | ||
expectedMultipartThresh: 0, | ||
expectedErr: true, | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
multipartThresh, err := ParseMultipartThresh(tc.multipartThreshStr) | ||
if tc.expectedErr { | ||
assert.Errorf(t, err, "tc.multipartThreshStr: %s", tc.multipartThreshStr) | ||
continue | ||
} | ||
assert.Equal(t, tc.expectedMultipartThresh, multipartThresh) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.