SaketaChalamchala commented on code in PR #4448:
URL: https://github.com/apache/ozone/pull/4448#discussion_r1157954294


##########
hadoop-ozone/dist/src/main/smoketest/s3/objectputget.robot:
##########
@@ -151,14 +151,34 @@ Incorrect values for end and start offset
                                 Should Be Equal            ${expectedData}     
       ${actualData}
 
 Zero byte file
-    ${result} =                 Execute AWSS3APICli and checkrc        
get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte 
--range bytes=0-0 /tmp/testfile2.result   255
-                                Should contain             ${result}        
InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        
get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte 
--range bytes=0-1 /tmp/testfile2.result   255
-                                Should contain             ${result}        
InvalidRange
-
-    ${result} =                 Execute AWSS3APICli and checkrc        
get-object --bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte 
--range bytes=0-10000 /tmp/testfile2.result   255
-                                Should contain             ${result}        
InvalidRange
+    ${result} =                                Execute                    
ozone sh bucket info /s3v/${BUCKET}
+    ${linked} =                        Execute                                
echo '${result}' | jq -j '.sourceVolume,"/",.sourceBucket'
+    ${eval} =                          Evaluate                               
"source" in """${linked}"""
+                                       IF      ${eval} == ${True}
+    ${result} =                 Execute                                       
ozone sh bucket info ${linked}
+                                               END
+    ${fsolayout} =                 Evaluate                           
"OPTIMIZED" in """${result}"""
+
+    ${result} =                 Execute AWSS3APICli and checkrc     get-object 
--bucket ${BUCKET} --key ${PREFIX}/putobject/key=value/zerobyte --range 
bytes=0-0 /tmp/testfile2.result   255
+                                       IF      ${fsolayout} == ${True}
+                                Should contain              ${result}       
NoSuchKey
+                                               ELSE
+                                Should contain              ${result}       
InvalidRange
+                                               END

Review Comment:
   This might be happening because all zero byte objects are created as 
directories in FSO bucket. Would it make sense to also make sure that 
`put-object --key f1/zero`(without trailing /) creates a file and `put-object 
--key f1/zero/`(with trailing /) creates a directory in FSO bucket?
   
   ```
   sh-4.2$ aws s3api --endpoint-url ${ENDPOINT_URL} put-object --bucket fso 
--key f1/  ## creates f1/ directory.
   sh-4.2$ aws s3api --endpoint-url ${ENDPOINT_URL} put-object --bucket fso 
--key f1/zero --body zero  ## zero is a 0 byte file. creates f1/zero/ dir.
   sh-4.2$ aws s3api --endpoint-url ${ENDPOINT_URL} put-object --bucket fso 
--key f1/test --body test ## test is an 8 byte file. creates f1/test file.
   
   sh-4.2$ ozone sh key list /s3v/fso
   [ {
     "volumeName" : "s3v",
     "bucketName" : "fso",
     "name" : "f1/",
     "dataSize" : 0,
     "creationTime" : "2023-04-05T02:11:23.723Z",
     "modificationTime" : "2023-04-05T02:11:23.723Z",
   ...
   }, {
     "volumeName" : "s3v",
     "bucketName" : "fso",
     "name" : "f1/test",
     "dataSize" : 8,
   ...
   }, {
     "volumeName" : "s3v",
     "bucketName" : "fso",
     "name" : "f1/zero/",
     "dataSize" : 0,
   ...
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to