fmorg-git commented on code in PR #11910:
URL: https://github.com/apache/ozone/pull/11910#discussion_r4461507223


##########
hadoop-ozone/dist/src/main/smoketest/security/ozone-secure-sts.robot:
##########
@@ -93,36 +93,47 @@ ${STS_LIFECYCLE_JSON}                   
{"Rules":[{"ID":"sts-lifecycle-rule","Pr
 
 *** Keywords ***
 Populate Iceberg Bucket
-    [Arguments]                   ${bucket}
-    FOR    ${key}    IN    @{ICEBERG_OBJECT_KEYS}
-        ${parent} =               Evaluate                      
__import__('os').path.dirname($key)
-        Run Keyword If            '${parent}' != ''             Execute    
mkdir -p ${TEMP_DIR}/${parent}
-        ${local_path} =           Set Variable                  
${TEMP_DIR}/${key}
-        Create File               ${local_path}                 iceberg test 
content
-        Execute                   ozone sh key put /s3v/${bucket}/${key} 
${local_path}
-    END
-    Create File                   ${TEMP_DIR}/zeroByteFile
-    Execute                       ozone sh key put /s3v/${bucket}/zeroByteFile 
${TEMP_DIR}/zeroByteFile
+    [Arguments]    ${bucket}    ${layout}
+
+    ${local_path} =    Set Variable    ${TEMP_DIR}/iceberg-test-content
+
+    Create File    ${local_path}    iceberg test content
+    Create File    ${TEMP_DIR}/zeroByteFile
+
+    Ozone Shell Batch
+    ...    bucket create --layout ${layout} /s3v/${bucket}
+    ...    key put /s3v/${bucket}/file1.txt ${local_path}
+    ...    key put /s3v/${bucket}/file1.txt ${local_path}
+    ...    key put /s3v/${bucket}/file1again.txt ${local_path}
+    ...    key put /s3v/${bucket}/folder/pepper.txt ${local_path}
+    ...    key put /s3v/${bucket}/folder/salt.txt ${local_path}
+    ...    key put /s3v/${bucket}/userA/userA.txt ${local_path}
+    ...    key put /s3v/${bucket}/userB/userB.txt ${local_path}
+    ...    key put /s3v/${bucket}/userAfile.txt ${local_path}
+    ...    key put /s3v/${bucket}/zeroByteFile ${TEMP_DIR}/zeroByteFile
     # Upload an explicit folder marker object to match AWS semantics.
-    Create File                   ${TEMP_DIR}/zero-byte-marker
-    Execute                       ozone sh key put 
/s3v/${bucket}/zeroByteFolder/ ${TEMP_DIR}/zero-byte-marker
+    ...    key put /s3v/${bucket}/zeroByteFolder/ ${TEMP_DIR}/zeroByteFile
+
+Setup Test Data
+
+    Populate Iceberg Bucket       ${ICEBERG_BUCKET_OBS}    
${ICEBERG_LAYOUT_OBS}
+    Populate Iceberg Bucket       ${ICEBERG_BUCKET_FSO}    
${ICEBERG_LAYOUT_FSO}
 
-Setup Same Volume Link Bucket
-    # Create a source bucket and a same-volume linked bucket (s3v/source -> 
s3v/s3v-source).
-    Kinit test user               hdfs                          hdfs.keytab
-    Execute                       ozone sh bucket create --layout 
${ICEBERG_LAYOUT_OBS} /s3v/${STS_LINK_BUCKET_SOURCE}
     Create File                   ${TEMP_DIR}/${STS_LINK_BUCKET_TESTFILE}    
link bucket test content
-    Execute                       ozone sh key put 
/s3v/${STS_LINK_BUCKET_SOURCE}/${STS_LINK_BUCKET_TESTFILE} 
${TEMP_DIR}/${STS_LINK_BUCKET_TESTFILE}
-    Execute                       ozone sh bucket link 
/s3v/${STS_LINK_BUCKET_SOURCE} /s3v/${STS_LINK_BUCKET_LINKED}
+    Create File                   
${TEMP_DIR}/${STS_LINK_BUCKET_CHAIN_TESTFILE}    chained link test content
 
-Setup Chained Same Volume Link Buckets
+    Ozone Shell Batch
+    # Create a source bucket and a same-volume linked bucket (s3v/source -> 
s3v/s3v-source).
+    ...    bucket create --layout ${ICEBERG_LAYOUT_OBS} 
/s3v/${STS_LINK_BUCKET_SOURCE}
+    ...    key put /s3v/${STS_LINK_BUCKET_SOURCE}/${STS_LINK_BUCKET_TESTFILE} 
${TEMP_DIR}/${STS_LINK_BUCKET_TESTFILE}
+    ...    bucket link /s3v/${STS_LINK_BUCKET_SOURCE} 
/s3v/${STS_LINK_BUCKET_LINKED}
     # Create source <- intermediate <- final chained links in s3v.
-    Kinit test user               hdfs                          hdfs.keytab
-    Execute                       ozone sh bucket create --layout 
${ICEBERG_LAYOUT_OBS} /s3v/${STS_LINK_BUCKET_CHAIN_SOURCE}
-    Create File                   
${TEMP_DIR}/${STS_LINK_BUCKET_CHAIN_TESTFILE}    chained link test content
-    Execute                       ozone sh key put 
/s3v/${STS_LINK_BUCKET_CHAIN_SOURCE}/${STS_LINK_BUCKET_CHAIN_TESTFILE} 
${TEMP_DIR}/${STS_LINK_BUCKET_CHAIN_TESTFILE}
-    Execute                       ozone sh bucket link 
/s3v/${STS_LINK_BUCKET_CHAIN_SOURCE} /s3v/${STS_LINK_BUCKET_CHAIN_INTERMEDIATE}
-    Execute                       ozone sh bucket link 
/s3v/${STS_LINK_BUCKET_CHAIN_INTERMEDIATE} /s3v/${STS_LINK_BUCKET_CHAIN_FINAL}
+    ...   bucket create --layout ${ICEBERG_LAYOUT_OBS} 
/s3v/${STS_LINK_BUCKET_CHAIN_SOURCE}
+    ...   key put 
/s3v/${STS_LINK_BUCKET_CHAIN_SOURCE}/${STS_LINK_BUCKET_CHAIN_TESTFILE} 
${TEMP_DIR}/${STS_LINK_BUCKET_CHAIN_TESTFILE}
+    ...   bucket link /s3v/${STS_LINK_BUCKET_CHAIN_SOURCE} 
/s3v/${STS_LINK_BUCKET_CHAIN_INTERMEDIATE}
+    ...   bucket link /s3v/${STS_LINK_BUCKET_CHAIN_INTERMEDIATE} 
/s3v/${STS_LINK_BUCKET_CHAIN_FINAL}
+    # Create bucket for DeleteBucket scenario
+    ...   bucket create --layout ${ICEBERG_LAYOUT_OBS} 
/s3v/${STS_BUCKET_TO_DELETE}

Review Comment:
   nit: can you indent to 4 spaces like the others, instead of 3?



##########
hadoop-ozone/dist/src/main/smoketest/security/ozone-secure-sts.robot:
##########
@@ -952,24 +958,20 @@ STS session policy CreateBucket must require bucket CREATE
     Should Not Contain            ${output}                     AccessDenied
 
 STS session policy DeleteBucket must require bucket DELETE
-    ${bucket_suffix} =            Generate Random String        8   [LOWER]
-    ${bucket} =                   Set Variable                  
sts-bucket-${bucket_suffix}
-    ${delete_policy} =            Set Variable                  
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:DeleteBucket","Resource":"arn:aws:s3:::${bucket}"}]}
+    ${delete_policy} =            Set Variable                  
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:DeleteBucket","Resource":"arn:aws:s3:::${STS_BUCKET_TO_DELETE}"}]}
 
-    # Prepare the bucket as a different principal so bucket-owner privileges
+    # Bucket was created as a different principal so bucket-owner privileges
     # do not mask missing DELETE permissions in the negative case.
-    Kinit test user               hdfs                          hdfs.keytab
-    ${output} =                   Execute                       ozone sh 
bucket create --layout ${ICEBERG_LAYOUT_OBS} /s3v/${bucket}
     Kinit test user               ${ICEBERG_SVC_CATALOG_USER}   
svc-iceberg-rest-catalog.keytab

Review Comment:
   this `Kinit test user               ${ICEBERG_SVC_CATALOG_USER}   
svc-iceberg-rest-catalog.keytab` may no longer be needed



-- 
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