@ -21,6 +21,7 @@ import (
"context"
"context"
"os"
"os"
"path/filepath"
"path/filepath"
"runtime"
"sync"
"sync"
"testing"
"testing"
"time"
"time"
@ -195,6 +196,11 @@ func TestCompleteMultipartUpload(t *testing.T) {
// TestCompleteMultipartUpload - test CompleteMultipartUpload
// TestCompleteMultipartUpload - test CompleteMultipartUpload
func TestAbortMultipartUpload ( t * testing . T ) {
func TestAbortMultipartUpload ( t * testing . T ) {
if runtime . GOOS == globalWindowsOSName {
// Concurrent AbortMultipartUpload() fails on windows
t . Skip ( )
}
// Prepare for tests
// Prepare for tests
disk := filepath . Join ( globalTestTmpDir , "minio-" + nextSuffix ( ) )
disk := filepath . Join ( globalTestTmpDir , "minio-" + nextSuffix ( ) )
defer os . RemoveAll ( disk )
defer os . RemoveAll ( disk )
@ -219,7 +225,6 @@ func TestAbortMultipartUpload(t *testing.T) {
if _ , err := obj . PutObjectPart ( GlobalContext , bucketName , objectName , uploadID , 1 , mustGetPutObjReader ( t , bytes . NewReader ( data ) , 5 , md5Hex , "" ) , opts ) ; err != nil {
if _ , err := obj . PutObjectPart ( GlobalContext , bucketName , objectName , uploadID , 1 , mustGetPutObjReader ( t , bytes . NewReader ( data ) , 5 , md5Hex , "" ) , opts ) ; err != nil {
t . Fatal ( "Unexpected error " , err )
t . Fatal ( "Unexpected error " , err )
}
}
time . Sleep ( time . Second ) // Without Sleep on windows, the fs.AbortMultipartUpload() fails with "The process cannot access the file because it is being used by another process."
if err := obj . AbortMultipartUpload ( GlobalContext , bucketName , objectName , uploadID , opts ) ; err != nil {
if err := obj . AbortMultipartUpload ( GlobalContext , bucketName , objectName , uploadID , opts ) ; err != nil {
t . Fatal ( "Unexpected error " , err )
t . Fatal ( "Unexpected error " , err )
}
}