-
Notifications
You must be signed in to change notification settings - Fork 616
HDDS-10655. Support PutObjectTagging, GetObjectTagging, and DeleteObjectTagging #6756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
9a581ed
a1c4da9
c356a62
1453d62
fc5b56d
dfdab88
ba54b0e
e69d86a
e06eab5
705d2ca
9f9ce9c
f18bd2c
2c8b70f
75023dd
00ff96a
1239179
3fd082c
ef0828c
5dbc376
1505a90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,8 +34,8 @@ private KeyValueUtil() { | |
| /** | ||
| * Parse Key,Value map data from protobuf representation. | ||
| */ | ||
| public static Map<String, String> getFromProtobuf(List<KeyValue> metadata) { | ||
| return metadata.stream() | ||
| public static Map<String, String> getFromProtobuf(List<KeyValue> keyValueList) { | ||
| return keyValueList.stream() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can avoid this change as it is only variable name change in the whole file
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review. I changed it since the user of this method is not for metadata only (i.e. tags). |
||
| .collect(Collectors.toMap(KeyValue::getKey, | ||
| KeyValue::getValue)); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License | ||
|
|
||
| *** Settings *** | ||
| Documentation S3 gateway test with aws cli | ||
| Library OperatingSystem | ||
| Library String | ||
| Resource ../commonlib.robot | ||
| Resource commonawslib.robot | ||
| Test Timeout 5 minutes | ||
| Suite Setup Setup s3 tests | ||
|
|
||
| *** Variables *** | ||
| ${ENDPOINT_URL} http://s3g:9878 | ||
| ${OZONE_TEST} true | ||
| ${BUCKET} generated | ||
|
|
||
|
|
||
| *** Test Cases *** | ||
|
|
||
| Put object tagging | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to add negative test cases (e.g. request for non-existent key). Can be done in follow-up. Also would be nice to create reusable keywords to avoid duplication. Also can be in follow-up.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review. I added for case non-existent key. The other cases like empty tag key and empty tag values are usually thrown in the AWS SDK client-side. I added the validation server-side just in case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed https://issues.apache.org/jira/browse/HDDS-11678 for extracting the object tagging keywords. |
||
| # Create an object and call put-object-tagging | ||
| Execute echo "Randomtext" > /tmp/testfile | ||
| ${result} = Execute AWSS3ApiCli put-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 --body /tmp/testfile | ||
| ${result} = Execute AWSS3ApiCli list-objects --bucket ${BUCKET} --prefix ${PREFIX}/putobject/key=value/ | ||
| Should contain ${result} f1 | ||
|
|
||
| ${result} = Execute AWSS3ApiCli put-object-tagging --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 --tagging '{"TagSet": [{ "Key": "tag-key1", "Value": "tag-value1" }]}' | ||
| ${result} = Execute AWSS3APICli get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 /tmp/testfile2.result | ||
| Should contain ${result} TagCount | ||
| ${tagCount} = Execute and checkrc echo '${result}' | jq -r '.TagCount' 0 | ||
| Should Be Equal ${tagCount} 1 | ||
|
|
||
| # Calling put-object-tagging again to overwrite the existing tags | ||
| ${result} = Execute AWSS3ApiCli put-object-tagging --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 --tagging '{"TagSet": [{ "Key": "tag-key2", "Value": "tag-value2" },{ "Key": "tag-key3", "Value": "tag-value3" }]}' | ||
| ${result} = Execute AWSS3APICli get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 /tmp/testfile2.result | ||
| Should contain ${result} TagCount | ||
| ${tagCount} = Execute and checkrc echo '${result}' | jq -r '.TagCount' 0 | ||
| Should Be Equal ${tagCount} 2 | ||
|
|
||
| #This test depends on the previous test case. Can't be executes alone | ||
| Get object tagging | ||
|
|
||
| ${result} = Execute AWSS3ApiCli get-object-tagging --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 | ||
| Should contain ${result} TagSet | ||
| ${tagCount} = Execute and checkrc echo '${result}' | jq '.TagSet | length' 0 | ||
| Should Be Equal ${tagCount} 2 | ||
|
|
||
|
|
||
| #This test depends on the previous test case. Can't be executes alone | ||
| Delete object tagging | ||
|
|
||
| ${result} = Execute AWSS3ApiCli delete-object-tagging --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 | ||
| ${result} = Execute AWSS3ApiCli get-object-tagging --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 | ||
| Should contain ${result} TagSet | ||
| ${tagCount} = Execute and checkrc echo '${result}' | jq '.TagSet | length' 0 | ||
| Should Be Equal ${tagCount} 0 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OzoneManagerVersion.OBJECT_TAGwas introduced in 8a23991. Any OM built since that commit but preceding this change does not support these methods. So request from client to such OM would fail withInvalidProtocolBufferException. Failing withIOException("OzoneManager does not support object tags")might be friendlier, but we need a newOzoneManagerVersionfor that.CC @errose28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduced a new
OzoneManagerVersion.