Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@

import org.apache.commons.collections.ListUtils;
import org.apache.hadoop.hdds.client.OzoneQuota;
import org.apache.hadoop.hdds.client.ReplicationConfig;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.scm.client.HddsClientUtils;
import org.apache.hadoop.ozone.OzoneAcl;
import org.apache.hadoop.ozone.client.io.OzoneInputStream;
import org.apache.hadoop.ozone.client.io.OzoneOutputStream;
import org.apache.hadoop.ozone.client.protocol.ClientProtocol;
import org.apache.hadoop.ozone.om.helpers.OmMultipartUploadCompleteInfo;
import org.apache.hadoop.ozone.om.helpers.WithMetadata;

import com.google.common.annotations.VisibleForTesting;
Expand Down Expand Up @@ -470,6 +474,52 @@ public Iterator<? extends OzoneBucket> listBuckets(String bucketPrefix,
public void deleteBucket(String bucketName) throws IOException {
proxy.deleteBucket(name, bucketName);
}
public OzoneKey headObject(String bucketName, String key) throws IOException {
return proxy.headObject(name, bucketName, key);
}

public OzoneKeyDetails getKey(String bucketName, String key)
throws IOException {
return proxy.getKeyDetails(name, bucketName, key);
}

public OzoneInputStream readKey(String bucketName, String key)
throws IOException {
return proxy.getKey(name, bucketName, key);
}

public void abortMultipartUpload(String bucketName, String key,
String uploadID) throws IOException {
proxy.abortMultipartUpload(this.name, bucketName, key, uploadID);
}

public void deleteKey(String bucketName, String key)
throws IOException {
proxy.deleteKey(name, bucketName, key, false);
}

public OzoneOutputStream createMultipartKey(String bucketName, String key,
long size, int partNumber,
String uploadID)
throws IOException {
return proxy.createMultipartKey(name, bucketName, key, size, partNumber,
uploadID);
}

public OzoneOutputStream createKey(String bucketName, String key, long size,
ReplicationConfig replicationConfig,
Map<String, String> keyMetadata)
throws IOException {
return proxy
.createKey(name, bucketName, key, size, replicationConfig, keyMetadata);
}

public OmMultipartUploadCompleteInfo completeMultipartUpload(
String bucketName, String key, String uploadID,
Map<Integer, String> partsMap) throws IOException {
return proxy.completeMultipartUpload(name, bucketName, key, uploadID,
partsMap);
}

public long getRefCount() {
return refCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1976,8 +1976,8 @@ public Cache<URI, KeyProvider> getKeyProviderCache() {
@Override
public OzoneKey headObject(String volumeName, String bucketName,
String keyName) throws IOException {
Preconditions.checkNotNull(volumeName);
Preconditions.checkNotNull(bucketName);
verifyBucketName(volumeName);
verifyBucketName(bucketName);
Preconditions.checkNotNull(keyName);
OmKeyArgs keyArgs = new OmKeyArgs.Builder()
.setVolumeName(volumeName)
Expand Down
46 changes: 46 additions & 0 deletions hadoop-ozone/dist/src/main/smoketest/s3/objecthead.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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 ***

Head existing object
Execute echo "Randomtext" > /tmp/testfile
${result} = Execute AWSS3APICli and checkrc put-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 --body /tmp/testfile 0

${result} = Execute AWSS3APICli and checkrc head-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/f1 0

Head object in unexisting bucket
${result} = Execute AWSS3APICli and checkrc head-object --bucket ${BUCKET}-non-exitst --key ${PREFIX}/putobject/key=value/f1 255
Should contain ${result} 404
Should contain ${result} Not Found

Head unexisting key
${result} = Execute AWSS3APICli and checkrc head-object --bucket ${BUCKET} --key ${PREFIX}/non-exist 255
Should contain ${result} 404
Should contain ${result} Not Found
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ run_robot_test objectputget
run_robot_test objectdelete
run_robot_test objectcopy
run_robot_test objectmultidelete
run_robot_test objecthead
run_robot_test MultipartUpload

rebot --outputdir results/ results/*.xml
Loading