From 341337617d8dd1f4f438d059c180f94cbe7864a1 Mon Sep 17 00:00:00 2001 From: "guangjun.hgj" Date: Tue, 16 Aug 2022 12:02:16 +0800 Subject: [PATCH] udpate testcase. --- oss/client_test.go | 4 +- oss/download_test.go | 1 + oss/livechannel_test.go | 5 ++- oss/multicopy_test.go | 67 +++++++++++++++++----------------- oss/multipart_test.go | 25 +++++++------ oss/select_csv_objcet_test.go | 1 + oss/select_json_object_test.go | 5 +++ oss/upload_test.go | 3 +- 8 files changed, 62 insertions(+), 49 deletions(-) diff --git a/oss/client_test.go b/oss/client_test.go index 35305cf4..fc44702d 100755 --- a/oss/client_test.go +++ b/oss/client_test.go @@ -64,6 +64,8 @@ var ( // for cloud box ID cloudBoxID = os.Getenv("OSS_TEST_CLOUDBOX_ID") + + kmsID = os.Getenv("OSS_TEST_KMS_ID") ) var ( @@ -3428,7 +3430,7 @@ func (s *OssClientSuite) TestSetBucketInventory(c *C) { // encryption config var invSseOss InvSseOss invSseKms := InvSseKms{ - KmsId: "keyId", + KmsId: kmsID, } var invEncryption InvEncryption diff --git a/oss/download_test.go b/oss/download_test.go index 9b4a979b..24038b5e 100644 --- a/oss/download_test.go +++ b/oss/download_test.go @@ -21,6 +21,7 @@ var _ = Suite(&OssDownloadSuite{}) // SetUpSuite runs once when the suite starts running func (s *OssDownloadSuite) SetUpSuite(c *C) { + bucketName := bucketNamePrefix + RandLowStr(6) if cloudboxControlEndpoint == "" { client, err := New(endpoint, accessID, accessKey) c.Assert(err, IsNil) diff --git a/oss/livechannel_test.go b/oss/livechannel_test.go index 08eb0dd6..84d3e38a 100644 --- a/oss/livechannel_test.go +++ b/oss/livechannel_test.go @@ -18,6 +18,7 @@ var _ = Suite(&OssBucketLiveChannelSuite{}) // SetUpSuite Run once when the suite starts running func (s *OssBucketLiveChannelSuite) SetUpSuite(c *C) { + bucketName := bucketNamePrefix + RandLowStr(6) if cloudboxControlEndpoint == "" { client, err := New(endpoint, accessID, accessKey) c.Assert(err, IsNil) @@ -108,8 +109,8 @@ func (s *OssBucketLiveChannelSuite) TestCreateLiveChannel(c *C) { result, err := s.bucket.CreateLiveChannel(channelName, config) c.Assert(err, IsNil) - playURL := getPlayURL(bucketName, channelName, playlistName) - publishURL := getPublishURL(bucketName, channelName) + playURL := getPlayURL(s.bucket.BucketName, channelName, playlistName) + publishURL := getPublishURL(s.bucket.BucketName, channelName) c.Assert(result.PlayUrls[0], Equals, playURL) c.Assert(result.PublishUrls[0], Equals, publishURL) diff --git a/oss/multicopy_test.go b/oss/multicopy_test.go index ffe1261c..3c1e50d0 100644 --- a/oss/multicopy_test.go +++ b/oss/multicopy_test.go @@ -20,6 +20,7 @@ var _ = Suite(&OssCopySuite{}) // SetUpSuite runs once when the suite starts running func (s *OssCopySuite) SetUpSuite(c *C) { + bucketName := bucketNamePrefix + RandLowStr(6) if cloudboxControlEndpoint == "" { client, err := New(endpoint, accessID, accessKey) c.Assert(err, IsNil) @@ -121,7 +122,7 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecovery(c *C) { os.Remove(newFile) // Does not specify parameter 'routines', by default it's single routine - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 100*1024) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 100*1024) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -136,7 +137,7 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecovery(c *C) { os.Remove(newFile) // Specify one routine. - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 100*1024, Routines(1)) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 100*1024, Routines(1)) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -151,7 +152,7 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecovery(c *C) { os.Remove(newFile) // Specify three routines, which is less than parts count 5 - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 100*1024, Routines(3)) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 100*1024, Routines(3)) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -166,7 +167,7 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecovery(c *C) { os.Remove(newFile) // Specify 5 routines which is the same as parts count - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 100*1024, Routines(5)) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 100*1024, Routines(5)) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -181,7 +182,7 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecovery(c *C) { os.Remove(newFile) // Specify routine count 10, which is more than parts count - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 100*1024, Routines(10)) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 100*1024, Routines(10)) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -196,7 +197,7 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecovery(c *C) { os.Remove(newFile) // Invalid routine count, will use single routine - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 100*1024, Routines(-1)) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 100*1024, Routines(-1)) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -211,7 +212,7 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecovery(c *C) { os.Remove(newFile) // Option - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 100*1024, Routines(3), Meta("myprop", "mypropval")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 100*1024, Routines(3), Meta("myprop", "mypropval")) meta, err := s.bucket.GetObjectDetailedMeta(destObjectName) c.Assert(err, IsNil) @@ -253,7 +254,7 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecoveryNegative(c *C) { copyPartHooker = CopyErrorHooker // Worker routine errors - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 100*1024, Routines(2)) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 100*1024, Routines(2)) c.Assert(err, NotNil) c.Assert(err.Error(), Equals, "ErrorHooker") @@ -264,13 +265,13 @@ func (s *OssCopySuite) TestCopyRoutineWithoutRecoveryNegative(c *C) { c.Assert(err, NotNil) // Target object does not exist - err = s.bucket.CopyFile(bucketName, "notexist", destObjectName, 100*1024, Routines(2)) + err = s.bucket.CopyFile(s.bucket.BucketName, "notexist", destObjectName, 100*1024, Routines(2)) // The part size is invalid - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024, Routines(2)) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024, Routines(2)) c.Assert(err, NotNil) - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*1024*1024*100, Routines(2)) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*1024*1024*100, Routines(2)) c.Assert(err, NotNil) // Delete the source file @@ -294,7 +295,7 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { // Copy object with checkpoint enabled, single runtine. // Copy 4 parts---the CopyErrorHooker makes sure the copy of part 5 will fail. copyPartHooker = CopyErrorHooker - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Checkpoint(true, destObjectName+".cp")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Checkpoint(true, destObjectName+".cp")) c.Assert(err, NotNil) c.Assert(err.Error(), Equals, "ErrorHooker") copyPartHooker = defaultCopyPartHook @@ -305,9 +306,9 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { c.Assert(err, IsNil) c.Assert(ccp.Magic, Equals, copyCpMagic) c.Assert(len(ccp.MD5), Equals, len("LC34jZU5xK4hlxi3Qn3XGQ==")) - c.Assert(ccp.SrcBucketName, Equals, bucketName) + c.Assert(ccp.SrcBucketName, Equals, s.bucket.BucketName) c.Assert(ccp.SrcObjectKey, Equals, srcObjectName) - c.Assert(ccp.DestBucketName, Equals, bucketName) + c.Assert(ccp.DestBucketName, Equals, s.bucket.BucketName) c.Assert(ccp.DestObjectKey, Equals, destObjectName) c.Assert(len(ccp.CopyID), Equals, len("3F79722737D1469980DACEDCA325BB52")) c.Assert(ccp.ObjStat.Size, Equals, int64(482048)) @@ -318,7 +319,7 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { c.Assert(ccp.PartStat[4], Equals, false) // Second copy, finish the last part - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Checkpoint(true, destObjectName+".cp")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Checkpoint(true, destObjectName+".cp")) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -337,7 +338,7 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { //multicopy with empty checkpoint path copyPartHooker = CopyErrorHooker - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Checkpoint(true, "")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Checkpoint(true, "")) c.Assert(err, NotNil) c.Assert(err.Error(), Equals, "ErrorHooker") copyPartHooker = defaultCopyPartHook @@ -347,7 +348,7 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { //multi copy with checkpoint dir copyPartHooker = CopyErrorHooker - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Routines(2), CheckpointDir(true, "./")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Routines(2), CheckpointDir(true, "./")) c.Assert(err, NotNil) c.Assert(err.Error(), Equals, "ErrorHooker") copyPartHooker = defaultCopyPartHook @@ -355,14 +356,14 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { // Check CP ccp = copyCheckpoint{} cpConf := cpConfig{IsEnable: true, DirPath: "./"} - cpFilePath := getCopyCpFilePath(&cpConf, bucketName, srcObjectName, s.bucket.BucketName, destObjectName, "") + cpFilePath := getCopyCpFilePath(&cpConf, s.bucket.BucketName, srcObjectName, s.bucket.BucketName, destObjectName, "") err = ccp.load(cpFilePath) c.Assert(err, IsNil) c.Assert(ccp.Magic, Equals, copyCpMagic) c.Assert(len(ccp.MD5), Equals, len("LC34jZU5xK4hlxi3Qn3XGQ==")) - c.Assert(ccp.SrcBucketName, Equals, bucketName) + c.Assert(ccp.SrcBucketName, Equals, s.bucket.BucketName) c.Assert(ccp.SrcObjectKey, Equals, srcObjectName) - c.Assert(ccp.DestBucketName, Equals, bucketName) + c.Assert(ccp.DestBucketName, Equals, s.bucket.BucketName) c.Assert(ccp.DestObjectKey, Equals, destObjectName) c.Assert(len(ccp.CopyID), Equals, len("3F79722737D1469980DACEDCA325BB52")) c.Assert(ccp.ObjStat.Size, Equals, int64(482048)) @@ -373,7 +374,7 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { c.Assert(ccp.PartStat[4], Equals, false) // Second copy, finish the last part. - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Routines(2), CheckpointDir(true, "./")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Routines(2), CheckpointDir(true, "./")) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -391,7 +392,7 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { c.Assert(err, NotNil) // First copy without error. - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Routines(3), Checkpoint(true, destObjectName+".cp")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Routines(3), Checkpoint(true, destObjectName+".cp")) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -406,7 +407,7 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { os.Remove(newFile) // Copy with multiple coroutines, no errors. - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Routines(10), Checkpoint(true, destObjectName+".cp")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Routines(10), Checkpoint(true, destObjectName+".cp")) c.Assert(err, IsNil) err = s.bucket.GetObjectToFile(destObjectName, newFile) @@ -421,7 +422,7 @@ func (s *OssCopySuite) TestCopyRoutineWithRecovery(c *C) { os.Remove(newFile) // Option - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Routines(5), Checkpoint(true, destObjectName+".cp"), Meta("myprop", "mypropval")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Routines(5), Checkpoint(true, destObjectName+".cp"), Meta("myprop", "mypropval")) c.Assert(err, IsNil) meta, err := s.bucket.GetObjectDetailedMeta(destObjectName) @@ -455,20 +456,20 @@ func (s *OssCopySuite) TestCopyRoutineWithRecoveryNegative(c *C) { c.Assert(err, NotNil) // Source object does not exist - err = s.bucket.CopyFile(bucketName, "notexist", destObjectName, 100*1024, Routines(2), Checkpoint(true, destObjectName+".cp")) + err = s.bucket.CopyFile(s.bucket.BucketName, "notexist", destObjectName, 100*1024, Routines(2), Checkpoint(true, destObjectName+".cp")) c.Assert(err, NotNil) // Specify part size is invalid. - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024, Checkpoint(true, destObjectName+".cp")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024, Checkpoint(true, destObjectName+".cp")) c.Assert(err, NotNil) - err = s.bucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*1024*1024*100, Routines(2), Checkpoint(true, destObjectName+".cp")) + err = s.bucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*1024*1024*100, Routines(2), Checkpoint(true, destObjectName+".cp")) c.Assert(err, NotNil) } // TestCopyFileCrossBucket is a cross bucket's direct copy. func (s *OssCopySuite) TestCopyFileCrossBucket(c *C) { - destBucketName := bucketName + "-desc" + destBucketName := s.bucket.BucketName + "-cross-b" srcObjectName := objectNamePrefix + RandStr(8) destObjectName := srcObjectName + "-dest" fileName := "../sample/BingWallpaper-2015-11-07.jpg" @@ -486,7 +487,7 @@ func (s *OssCopySuite) TestCopyFileCrossBucket(c *C) { os.Remove(newFile) // Copy files - err = destBucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Routines(5), Checkpoint(true, destObjectName+".cp")) + err = destBucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Routines(5), Checkpoint(true, destObjectName+".cp")) c.Assert(err, IsNil) err = destBucket.GetObjectToFile(destObjectName, newFile) @@ -501,7 +502,7 @@ func (s *OssCopySuite) TestCopyFileCrossBucket(c *C) { os.Remove(newFile) // Copy file with options - err = destBucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, Routines(10), Checkpoint(true, "copy.cp"), Meta("myprop", "mypropval")) + err = destBucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, Routines(10), Checkpoint(true, "copy.cp"), Meta("myprop", "mypropval")) c.Assert(err, IsNil) err = destBucket.GetObjectToFile(destObjectName, newFile) @@ -611,7 +612,7 @@ func (s *OssCopySuite) TestVersioningCopyFileCrossBucket(c *C) { // TestCopyFileChoiceOptions func (s *OssCopySuite) TestCopyFileChoiceOptions(c *C) { - destBucketName := bucketName + "-desc" + destBucketName := s.bucket.BucketName + "-desc" srcObjectName := objectNamePrefix + RandStr(8) destObjectName := srcObjectName + "-dest" fileName := "../sample/BingWallpaper-2015-11-07.jpg" @@ -639,7 +640,7 @@ func (s *OssCopySuite) TestCopyFileChoiceOptions(c *C) { } // Copy files - err = destBucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, options...) + err = destBucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, options...) c.Assert(err, IsNil) // check object @@ -667,7 +668,7 @@ func (s *OssCopySuite) TestCopyFileChoiceOptions(c *C) { Checkpoint(true, "copy.cp"), // with checkpoint } - err = destBucket.CopyFile(bucketName, srcObjectName, destObjectName, 1024*100, options...) + err = destBucket.CopyFile(s.bucket.BucketName, srcObjectName, destObjectName, 1024*100, options...) c.Assert(err, IsNil) // check object diff --git a/oss/multipart_test.go b/oss/multipart_test.go index abec874d..fab0c007 100644 --- a/oss/multipart_test.go +++ b/oss/multipart_test.go @@ -21,6 +21,7 @@ var _ = Suite(&OssBucketMultipartSuite{}) // SetUpSuite runs once when the suite starts running func (s *OssBucketMultipartSuite) SetUpSuite(c *C) { + bucketName := bucketNamePrefix + RandLowStr(6) if cloudboxControlEndpoint == "" { client, err := New(endpoint, accessID, accessKey) c.Assert(err, IsNil) @@ -256,7 +257,7 @@ func (s *OssBucketMultipartSuite) TestUploadPartCopy(c *C) { c.Assert(err, IsNil) var parts []UploadPart for _, chunk := range chunks { - part, err := s.bucket.UploadPartCopy(imur, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) + part, err := s.bucket.UploadPartCopy(imur, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) c.Assert(err, IsNil) parts = append(parts, part) } @@ -307,7 +308,7 @@ func (s *OssBucketMultipartSuite) TestListUploadedParts(c *C) { imurCopy, err := s.bucket.InitiateMultipartUpload(objectDest) var partsCopy []UploadPart for _, chunk := range chunks { - part, err := s.bucket.UploadPartCopy(imurCopy, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) + part, err := s.bucket.UploadPartCopy(imurCopy, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) c.Assert(err, IsNil) partsCopy = append(partsCopy, part) } @@ -373,7 +374,7 @@ func (s *OssBucketMultipartSuite) TestAbortMultipartUpload(c *C) { imurCopy, err := s.bucket.InitiateMultipartUpload(objectDest) var partsCopy []UploadPart for _, chunk := range chunks { - part, err := s.bucket.UploadPartCopy(imurCopy, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) + part, err := s.bucket.UploadPartCopy(imurCopy, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) c.Assert(err, IsNil) partsCopy = append(partsCopy, part) } @@ -428,13 +429,13 @@ func (s *OssBucketMultipartSuite) TestUploadPartCopyWithConstraints(c *C) { imur, err := s.bucket.InitiateMultipartUpload(objectDest) var parts []UploadPart for _, chunk := range chunks { - _, err = s.bucket.UploadPartCopy(imur, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number), + _, err = s.bucket.UploadPartCopy(imur, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number), CopySourceIfModifiedSince(futureDate)) c.Assert(err, NotNil) } for _, chunk := range chunks { - _, err = s.bucket.UploadPartCopy(imur, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number), + _, err = s.bucket.UploadPartCopy(imur, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number), CopySourceIfUnmodifiedSince(futureDate)) c.Assert(err, IsNil) } @@ -444,13 +445,13 @@ func (s *OssBucketMultipartSuite) TestUploadPartCopyWithConstraints(c *C) { testLogger.Println("GetObjectDetailedMeta:", meta) for _, chunk := range chunks { - _, err = s.bucket.UploadPartCopy(imur, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number), + _, err = s.bucket.UploadPartCopy(imur, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number), CopySourceIfNoneMatch(meta.Get("Etag"))) c.Assert(err, NotNil) } for _, chunk := range chunks { - part, err := s.bucket.UploadPartCopy(imur, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number), + part, err := s.bucket.UploadPartCopy(imur, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number), CopySourceIfMatch(meta.Get("Etag"))) c.Assert(err, IsNil) parts = append(parts, part) @@ -520,12 +521,12 @@ func (s *OssBucketMultipartSuite) TestUploadPartCopyOutofOrder(c *C) { imur, err := s.bucket.InitiateMultipartUpload(objectDest) var parts []UploadPart for _, chunk := range chunks { - _, err := s.bucket.UploadPartCopy(imur, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) + _, err := s.bucket.UploadPartCopy(imur, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) c.Assert(err, IsNil) } // Double copy for _, chunk := range chunks { - part, err := s.bucket.UploadPartCopy(imur, bucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) + part, err := s.bucket.UploadPartCopy(imur, s.bucket.BucketName, objectSrc, chunk.Offset, chunk.Size, (int)(chunk.Number)) c.Assert(err, IsNil) parts = append(parts, part) } @@ -692,7 +693,7 @@ func (s *OssBucketMultipartSuite) TestMultipartNegative(c *C) { _, err = s.bucket.UploadPartFromFile(imur, fileName, 0, 1024, 1) c.Assert(err, NotNil) - _, err = s.bucket.UploadPartCopy(imur, bucketName, fileName, 0, 1024, 1) + _, err = s.bucket.UploadPartCopy(imur, s.bucket.BucketName, fileName, 0, 1024, 1) c.Assert(err, NotNil) err = s.bucket.AbortMultipartUpload(imur) @@ -717,10 +718,10 @@ func (s *OssBucketMultipartSuite) TestMultipartNegative(c *C) { _, err = s.bucket.UploadPartFromFile(imur, fileName, 0, 102400, 10001) c.Assert(err, NotNil) - _, err = s.bucket.UploadPartCopy(imur, bucketName, fileName, 0, 1024, 1) + _, err = s.bucket.UploadPartCopy(imur, s.bucket.BucketName, fileName, 0, 1024, 1) c.Assert(err, NotNil) - _, err = s.bucket.UploadPartCopy(imur, bucketName, fileName, 0, 1024, 1000) + _, err = s.bucket.UploadPartCopy(imur, s.bucket.BucketName, fileName, 0, 1024, 1000) c.Assert(err, NotNil) err = s.bucket.AbortMultipartUpload(imur) diff --git a/oss/select_csv_objcet_test.go b/oss/select_csv_objcet_test.go index a87f944b..1a1e51f1 100644 --- a/oss/select_csv_objcet_test.go +++ b/oss/select_csv_objcet_test.go @@ -19,6 +19,7 @@ type OssSelectCsvSuite struct { var _ = Suite(&OssSelectCsvSuite{}) func (s *OssSelectCsvSuite) SetUpSuite(c *C) { + bucketName := bucketNamePrefix + RandLowStr(6) if cloudboxControlEndpoint == "" { client, err := New(endpoint, accessID, accessKey) c.Assert(err, IsNil) diff --git a/oss/select_json_object_test.go b/oss/select_json_object_test.go index 62bd4b58..5d749c81 100644 --- a/oss/select_json_object_test.go +++ b/oss/select_json_object_test.go @@ -18,6 +18,7 @@ type OssSelectJsonSuite struct { var _ = Suite(&OssSelectJsonSuite{}) func (s *OssSelectJsonSuite) SetUpSuite(c *C) { + bucketName := bucketNamePrefix + RandLowStr(6) if cloudboxControlEndpoint == "" { client, err := New(endpoint, accessID, accessKey) c.Assert(err, IsNil) @@ -509,3 +510,7 @@ func (s *OssSelectJsonSuite) TestSelectJsonParseNumAsString(c *C) { err = s.bucket.DeleteObject(key) c.Assert(err, IsNil) } + +func escaped_slashs(value string) string { + return strings.Replace(value, "/", "\\/", -1) +} diff --git a/oss/upload_test.go b/oss/upload_test.go index 603d73eb..d1943074 100644 --- a/oss/upload_test.go +++ b/oss/upload_test.go @@ -20,6 +20,7 @@ var _ = Suite(&OssUploadSuite{}) // SetUpSuite runs once when the suite starts running func (s *OssUploadSuite) SetUpSuite(c *C) { + bucketName := bucketNamePrefix + RandLowStr(6) if cloudboxControlEndpoint == "" { client, err := New(endpoint, accessID, accessKey) c.Assert(err, IsNil) @@ -92,7 +93,7 @@ func (s *OssUploadSuite) TearDownSuite(c *C) { err := s.client.DeleteBucket(s.bucket.BucketName) c.Assert(err, IsNil) } - + testLogger.Println("test upload completed") }