This is an automated email from the ASF dual-hosted git repository.

smengcl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 0665932dd35 HDDS-15088. S3 SDK Test Suite and Smoke Test Integration 
(#10761)
0665932dd35 is described below

commit 0665932dd35da4d05087e02748af0a64eb846ad5
Author: Chun-Hung Tseng <[email protected]>
AuthorDate: Thu Oct 15 07:00:59 2026 +0200

    HDDS-15088. S3 SDK Test Suite and Smoke Test Integration (#10761)
    
    Co-authored-by: Wei-Chiu Chuang <[email protected]>
---
 .../src/main/smoketest/ozonelocal/locals3.robot    | 55 ++++++++++++++++++++++
 .../hadoop/ozone/local/TestLocalOzoneS3.java       | 34 +++++++++++++
 2 files changed, 89 insertions(+)

diff --git a/hadoop-ozone/dist/src/main/smoketest/ozonelocal/locals3.robot 
b/hadoop-ozone/dist/src/main/smoketest/ozonelocal/locals3.robot
new file mode 100644
index 00000000000..237a2f76de4
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/smoketest/ozonelocal/locals3.robot
@@ -0,0 +1,55 @@
+# 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 against ozone local
+Library             OperatingSystem
+Library             String
+Resource            ../commonlib.robot
+Resource            ../s3/commonawslib.robot
+Test Timeout        5 minutes
+Suite Setup         Setup local ozone S3 smoke
+
+*** Variables ***
+# Needs ozone local run --s3g-port 9878; the S3 Gateway port is ephemeral by 
default.
+${ENDPOINT_URL}       http://127.0.0.1:9878
+# LocalOzoneClusterConfig.LOCAL_S3_ACCESS_KEY, LOCAL_S3_SECRET_KEY and 
LOCAL_S3_REGION.
+${S3_ACCESS_KEY}      admin
+${S3_SECRET_KEY}      admin123
+${S3_REGION}          us-east-1
+
+*** Keywords ***
+Setup local ozone S3 smoke
+    Install aws cli
+    Execute                    aws configure set aws_access_key_id 
${S3_ACCESS_KEY}
+    Execute                    aws configure set aws_secret_access_key 
${S3_SECRET_KEY}
+    Execute                    aws configure set region ${S3_REGION}
+    Execute                    aws configure set default.s3.signature_version 
s3v4
+    Execute                    aws configure set default.s3.addressing_style 
path
+    ${random} =                Generate Random String    8    [LOWER]
+    Set Suite Variable         ${BUCKET}    bucket-${random}
+    Create bucket with name    ${BUCKET}
+
+*** Test Cases ***
+AWS CLI can create list put and get against ozone local
+    Execute                    echo "local ozone" > /tmp/local-ozone-smoke.txt
+    ${result} =                Execute AWSS3APICli    list-buckets
+    Should Contain             ${result}    ${BUCKET}
+    ${result} =                Execute AWSS3Cli    cp 
/tmp/local-ozone-smoke.txt s3://${BUCKET}/smoke.txt
+    Should Contain             ${result}    upload
+    ${result} =                Execute AWSS3Cli    ls s3://${BUCKET}
+    Should Contain             ${result}    smoke.txt
+    Execute AWSS3APICli        get-object --bucket ${BUCKET} --key smoke.txt 
/tmp/local-ozone-smoke-copy.txt
+    Compare files              /tmp/local-ozone-smoke.txt    
/tmp/local-ozone-smoke-copy.txt
diff --git 
a/hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/local/TestLocalOzoneS3.java
 
b/hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/local/TestLocalOzoneS3.java
index 4cdaa7137f9..55abe352b43 100644
--- 
a/hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/local/TestLocalOzoneS3.java
+++ 
b/hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/local/TestLocalOzoneS3.java
@@ -30,9 +30,12 @@
 import org.junit.jupiter.api.io.TempDir;
 import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
 import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.core.ResponseBytes;
 import software.amazon.awssdk.core.sync.RequestBody;
 import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.s3.S3Client;
+import software.amazon.awssdk.services.s3.model.GetObjectResponse;
+import software.amazon.awssdk.services.s3.model.ListBucketsResponse;
 import software.amazon.awssdk.services.s3.model.StorageClass;
 
 /**
@@ -92,4 +95,35 @@ private static S3Client s3Client(String endpoint, String 
accessKey, String secre
         .forcePathStyle(true)
         .build();
   }
+
+  /** Exercises create, list, put and get with explicit SDK credentials. */
+  @Test
+  void awsSdkCanCreateListPutAndGetAgainstLocalRuntime() throws Exception {
+    LocalOzoneClusterConfig config = 
LocalOzoneClusterConfig.builder(tempDir.resolve("local-ozone-s3-sdk")).build();
+
+    String bucketName = "local-" + UUID.randomUUID().toString().replace("-", 
"");
+    String keyName = "key-" + UUID.randomUUID().toString().replace("-", "");
+    String payload = "local-ozone-s3";
+    OzoneConfiguration conf = new OzoneConfiguration();
+    // Match the test module's 128 MB containers; production blocks default to 
256 MB.
+    ClientConfigForTesting.newBuilder(StorageUnit.MB).applyTo(conf);
+
+    try (LocalOzoneCluster cluster = new LocalOzoneCluster(config, conf)) {
+      cluster.start();
+
+      try (S3Client client = s3Client(cluster.getS3Endpoint(),
+          LocalOzoneClusterConfig.LOCAL_S3_ACCESS_KEY, 
LocalOzoneClusterConfig.LOCAL_S3_SECRET_KEY)) {
+        client.createBucket(builder -> builder.bucket(bucketName));
+
+        ListBucketsResponse buckets = client.listBuckets();
+        assertTrue(buckets.buckets().stream().anyMatch(bucket -> 
bucketName.equals(bucket.name())));
+
+        client.putObject(builder -> builder.bucket(bucketName).key(keyName), 
RequestBody.fromString(payload));
+
+        ResponseBytes<GetObjectResponse> response = client.getObjectAsBytes(
+            builder -> builder.bucket(bucketName).key(keyName));
+        assertEquals(payload, response.asUtf8String());
+      }
+    }
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to