Browse Source

update batch

tags/v0.7.3
jojoliang 5 years ago
parent
commit
699fef2159
  1. 20
      batch_test.go
  2. 6
      costesting/ci_test.go
  3. 9
      example/batch/create_job.go

20
batch_test.go

@ -8,7 +8,7 @@ import (
"reflect"
"testing"
"github.com/google/uuid"
"github.com/google/uuid"
)
func TestBatchService_CreateJob(t *testing.T) {
@ -21,7 +21,7 @@ func TestBatchService_CreateJob(t *testing.T) {
Manifest: &BatchJobManifest{
Location: &BatchJobManifestLocation{
ETag: "15150651828fa9cdcb8356b6d1c7638b",
ObjectArn: "qcs::cos:ap-chengdu::sourcebucket-1250000000/manifests/batch-copy-manifest.csv",
ObjectArn: "qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000/manifests/batch-copy-manifest.csv",
},
Spec: &BatchJobManifestSpec{
Fields: []string{"Bucket", "Key"},
@ -30,12 +30,12 @@ func TestBatchService_CreateJob(t *testing.T) {
},
Operation: &BatchJobOperation{
PutObjectCopy: &BatchJobOperationCopy{
TargetResource: "qcs::cos:ap-chengdu::destinationbucket-1250000000",
TargetResource: "qcs::cos:ap-chengdu:uid/1250000000:destinationbucket-1250000000",
},
},
Priority: 1,
Report: &BatchJobReport{
Bucket: "qcs::cos:ap-chengdu::sourcebucket-1250000000",
Bucket: "qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000",
Enabled: "true",
Format: "Report_CSV_V1",
Prefix: "job-result",
@ -104,7 +104,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
<Manifest>
<Location>
<ETag>&quot;15150651828fa9cdcb8356b6d1c7638b&quot;</ETag>
<ObjectArn>qcs::cos:ap-chengdu::sourcebucket-1250000000/manifests/batch-copy-manifest.csv</ObjectArn>
<ObjectArn>qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000/manifests/batch-copy-manifest.csv</ObjectArn>
</Location>
<Spec>
<Fields>
@ -116,7 +116,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
</Manifest>
<Operation>
<COSPutObjectCopy>
<TargetResource>qcs::cos:ap-chengdu::destinationbucket-1250000000</TargetResource>
<TargetResource>qcs::cos:ap-chengdu:uid/1250000000:destinationbucket-1250000000</TargetResource>
</COSPutObjectCopy>
</Operation>
<Priority>10</Priority>
@ -126,7 +126,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
<TotalNumberOfTasks>10</TotalNumberOfTasks>
</ProgressSummary>
<Report>
<Bucket>qcs::cos:ap-chengdu::sourcebucket-1250000000</Bucket>
<Bucket>qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000</Bucket>
<Enabled>true</Enabled>
<Format>Report_CSV_V1</Format>
<Prefix>job-result</Prefix>
@ -159,7 +159,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
Manifest: &BatchJobManifest{
Location: &BatchJobManifestLocation{
ETag: "\"15150651828fa9cdcb8356b6d1c7638b\"",
ObjectArn: "qcs::cos:ap-chengdu::sourcebucket-1250000000/manifests/batch-copy-manifest.csv",
ObjectArn: "qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000/manifests/batch-copy-manifest.csv",
},
Spec: &BatchJobManifestSpec{
Fields: []string{"Bucket", "Key"},
@ -168,7 +168,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
},
Operation: &BatchJobOperation{
PutObjectCopy: &BatchJobOperationCopy{
TargetResource: "qcs::cos:ap-chengdu::destinationbucket-1250000000",
TargetResource: "qcs::cos:ap-chengdu:uid/1250000000:destinationbucket-1250000000",
},
},
Priority: 10,
@ -178,7 +178,7 @@ func TestBatchService_DescribeJob(t *testing.T) {
TotalNumberOfTasks: 10,
},
Report: &BatchJobReport{
Bucket: "qcs::cos:ap-chengdu::sourcebucket-1250000000",
Bucket: "qcs::cos:ap-chengdu:uid/1250000000:sourcebucket-1250000000",
Enabled: "true",
Format: "Report_CSV_V1",
Prefix: "job-result",

6
costesting/ci_test.go

@ -751,7 +751,7 @@ func (s *CosTestSuite) TestBatch() {
Manifest: &cos.BatchJobManifest{
Location: &cos.BatchJobManifestLocation{
ETag: etag,
ObjectArn: "qcs::cos:" + kBatchRegion + "::" + kBatchBucket + "/" + manifest_name,
ObjectArn: "qcs::cos:" + kBatchRegion + ":uid/" + s.Appid + ":" + kBatchBucket + "/" + manifest_name,
},
Spec: &cos.BatchJobManifestSpec{
Fields: []string{"Bucket", "Key"},
@ -760,12 +760,12 @@ func (s *CosTestSuite) TestBatch() {
},
Operation: &cos.BatchJobOperation{
PutObjectCopy: &cos.BatchJobOperationCopy{
TargetResource: "qcs::cos:" + kBatchRegion + "::" + kTargetBatchBucket,
TargetResource: "qcs::cos:" + kBatchRegion + ":uid/" + s.Appid + ":" + kTargetBatchBucket,
},
},
Priority: 1,
Report: &cos.BatchJobReport{
Bucket: "qcs::cos:" + kBatchRegion + "::" + kBatchBucket,
Bucket: "qcs::cos:" + kBatchRegion + ":uid/" + s.Appid + ":" + kBatchBucket,
Enabled: "true",
Format: "Report_CSV_V1",
Prefix: "job-result",

9
example/batch/create_job.go

@ -2,20 +2,21 @@ package main
import (
"context"
"fmt"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"fmt"
"github.com/google/uuid"
"github.com/tencentyun/cos-go-sdk-v5"
"github.com/tencentyun/cos-go-sdk-v5/debug"
"github.com/google/uuid"
)
func main() {
test_batch_bucket := "testcd-1259654469"
target_batch_bucket := "targetcd-1259654469"
target_batch_bucket := "cosgosdkreptest-1259654469"
appid := 1259654469
uin := "100010805041"
region := "ap-chengdu"
@ -73,7 +74,7 @@ func main() {
},
Operation: &cos.BatchJobOperation{
PutObjectCopy: &cos.BatchJobOperationCopy{
TargetResource: "qcs::cos:" + region + "::" + target_batch_bucket,
TargetResource: "qcs::cos:" + region + ":uid/" + strconv.Itoa(appid) + ":" + target_batch_bucket,
},
},
Priority: 1,

Loading…
Cancel
Save