Skip to content

Commit

Permalink
1、修复 ListObjectsInput fetch_owner 的类型错误
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengzhiqi.zzq committed Sep 27, 2024
1 parent f730747 commit e88fc4a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
35 changes: 35 additions & 0 deletions pkg/grpc/extension/s3/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ func TestListObjects(t *testing.T) {
MaxKeys: 1,
Prefix: "Prefix",
RequestPayer: "RequestPayer",
FetchOwner: true,
}
_, err := s3Server.ListObjects(ctx, req)
assert.Equal(t, status.Errorf(codes.InvalidArgument, NotSupportStoreName, "NoStore"), err)
Expand All @@ -362,6 +363,40 @@ func TestListObjects(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, true, resp.IsTruncated)
assert.Equal(t, "delimiter", resp.Delimiter)

ctx = context.TODO()
req = &s3.ListObjectsInput{
StoreName: "NoStore",
Bucket: "layotto",
Delimiter: "delimiter",
EncodingType: "EncodingType",
ExpectedBucketOwner: "ExpectedBucketOwner",
Marker: "Marker",
MaxKeys: 1,
Prefix: "Prefix",
RequestPayer: "RequestPayer",
}
_, err = s3Server.ListObjects(ctx, req)
assert.Equal(t, status.Errorf(codes.InvalidArgument, NotSupportStoreName, "NoStore"), err)
output = &l8s3.ListObjectsOutput{Delimiter: "delimiter", IsTruncated: true}
mockossServer.EXPECT().ListObjects(ctx,
&l8s3.ListObjectsInput{
Bucket: "layotto",
Delimiter: "delimiter",
EncodingType: "EncodingType",
ExpectedBucketOwner: "ExpectedBucketOwner",
Marker: "Marker",
MaxKeys: 1,
Prefix: "Prefix",
RequestPayer: "RequestPayer",
FetchOwner: false,
},
).Return(output, nil)
req.StoreName = MOCKSERVER
resp, err = s3Server.ListObjects(ctx, req)
assert.Nil(t, err)
assert.Equal(t, true, resp.IsTruncated)
assert.Equal(t, "delimiter", resp.Delimiter)
}

// TestGetObjectCannedAcl
Expand Down
8 changes: 4 additions & 4 deletions spec/proto/extension/v1/s3/oss.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/proto/extension/v1/s3/oss.proto
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ message ListObjectsInput{
// Confirms that the requester knows that they will be charged for the request.
string request_payer = 9;
// Decide whether fetch owner info from server,which is required for aliyun oss.
string fetch_owner = 10;
bool fetch_owner = 10;
}

// ListObjectsOutput
Expand Down

0 comments on commit e88fc4a

Please sign in to comment.