tests: xl-v1-metadata.go, xl-v1-multipart-common.go - remove unused methods, add enhance tests to improve code coverage. (#2260)

This commit is contained in:
Krishna Srinivas
2016-07-22 03:30:11 +05:30
committed by Harshavardhana
parent a7b5b8e63f
commit 303f216150
4 changed files with 25 additions and 83 deletions
+25
View File
@@ -1686,6 +1686,14 @@ func (s *TestSuiteCommon) TestObjectMultipartAbort(c *C) {
c.Assert(response.StatusCode, Equals, http.StatusOK)
objectName := "test-multipart-object"
// 1. Initiate 2 uploads for the same object
// 2. Upload 2 parts for the second upload
// 3. Abort the second upload.
// 4. Abort the first upload.
// This will test abort upload when there are more than one upload IDs
// and the case where there is only one upload ID.
// construct HTTP request to initiate a NewMultipart upload.
request, err = newTestSignedRequest("POST", getNewMultipartURL(s.endPoint, bucketName, objectName),
0, nil, s.accessKey, s.secretKey)
@@ -1699,6 +1707,23 @@ func (s *TestSuiteCommon) TestObjectMultipartAbort(c *C) {
decoder := xml.NewDecoder(response.Body)
newResponse := &InitiateMultipartUploadResponse{}
err = decoder.Decode(newResponse)
c.Assert(err, IsNil)
c.Assert(len(newResponse.UploadID) > 0, Equals, true)
// construct HTTP request to initiate a NewMultipart upload.
request, err = newTestSignedRequest("POST", getNewMultipartURL(s.endPoint, bucketName, objectName),
0, nil, s.accessKey, s.secretKey)
c.Assert(err, IsNil)
// execute the HTTP request initiating the new multipart upload.
response, err = client.Do(request)
c.Assert(response.StatusCode, Equals, http.StatusOK)
// parse the response body and obtain the new upload ID.
decoder = xml.NewDecoder(response.Body)
newResponse = &InitiateMultipartUploadResponse{}
err = decoder.Decode(newResponse)
c.Assert(err, IsNil)
c.Assert(len(newResponse.UploadID) > 0, Equals, true)