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

adoroszlai 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 3a66b788832 HDDS-17800. Speed up basic/links.robot (#12043)
3a66b788832 is described below

commit 3a66b788832ae7b3c2ef0d3d70c6b481128675c6
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Sat Nov 14 19:23:08 2026 +0100

    HDDS-17800. Speed up basic/links.robot (#12043)
---
 .../java/org/apache/hadoop/ozone/shell/Shell.java  |   6 +-
 .../dist/src/main/smoketest/basic/links.robot      | 356 ++++++++++++---------
 .../src/main/smoketest/basic/ozone-shell-lib.robot |   3 +
 .../dist/src/main/smoketest/commonlib.robot        |   4 +-
 hadoop-ozone/dist/src/main/smoketest/lib/os.robot  |   9 +
 .../dist/src/main/smoketest/ozone-lib/batch.robot  | 116 +++++++
 .../dist/src/main/smoketest/ozone-lib/shell.robot  |  12 +-
 7 files changed, 338 insertions(+), 168 deletions(-)

diff --git 
a/hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/Shell.java 
b/hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/Shell.java
index 0ae6c5b850f..19225aa573c 100644
--- 
a/hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/Shell.java
+++ 
b/hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/Shell.java
@@ -57,6 +57,10 @@ public abstract class Shell extends GenericCli {
   @CommandLine.Spec
   private CommandLine.Model.CommandSpec spec;
 
+  @CommandLine.Option(names = {"--continue-batch-on-error"},
+      description = "Continue with batch execution (see --execute) if error 
happens")
+  private boolean continueOnError;
+
   @CommandLine.ArgGroup
   private ExecutionMode executionMode;
 
@@ -107,7 +111,7 @@ private int execute(CommandLine.ParseResult parseResult) {
 
   private void installBatchExceptionHandler() {
     // exit on first error in batch mode
-    if (!executionMode.interactive) {
+    if (!executionMode.interactive && !continueOnError) {
       CommandLine.IExecutionExceptionHandler handler = 
getCmd().getExecutionExceptionHandler();
       getCmd().setExecutionExceptionHandler((ex, cli, parseResult) -> {
         try {
diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/links.robot 
b/hadoop-ozone/dist/src/main/smoketest/basic/links.robot
index 0bae80e5d52..558cbd48763 100644
--- a/hadoop-ozone/dist/src/main/smoketest/basic/links.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/basic/links.robot
@@ -18,225 +18,261 @@ Documentation       Test bucket links via Ozone CLI
 Library             OperatingSystem
 Resource            ../commonlib.robot
 Resource            ../ozone-lib/shell.robot
-Test Setup          Run Keyword if    '${SECURITY_ENABLED}' == 'true'    Kinit 
test user     testuser     testuser.keytab
+Resource            ../ozone-lib/batch.robot
 Test Timeout        4 minute
-Suite Setup         Create volumes
+Suite Setup         Setup Suite
+Suite Teardown      Teardown Suite
 
 *** Variables ***
 ${prefix}    generated
 ${SCM}       scm
 
 *** Keywords ***
-Create volumes
+Setup Suite
     Get Security Enabled From Config
+    Setup Batch
+    Kinit test user
+    Setup Tests
+    Setup Secure Tests
+
+Teardown Suite
+    Teardown Batch
+
+Setup Tests
     ${random} =         Generate Random String  5  [NUMBERS]
     Set Suite Variable  ${source}  ${random}-source
     Set Suite Variable  ${target}  ${random}-target
-    Ozone Shell Batch   volume create ${source}
-    ...                 volume create ${target}
-    Run Keyword if      '${SECURITY_ENABLED}' == 'true'    Setup ACL tests
-
-Setup ACL tests
-    Ozone Shell Batch   bucket create ${source}/readable-bucket
-    ...                 key put 
${source}/readable-bucket/key-in-readable-bucket /etc/passwd
-    ...                 bucket create ${source}/unreadable-bucket
-    ...                 bucket link ${source}/unreadable-bucket 
${target}/link-to-unreadable-bucket
-    ...                 volume addacl --acl user:testuser2:r[DEFAULT] ${target}
-    ...                 bucket link ${source}/readable-bucket 
${target}/readable-link
-    ...                 bucket link ${source}/readable-bucket 
${target}/readable-link2
-    ...                 volume addacl --acl user:testuser2:rl ${source}
-    ...                 bucket addacl --acl user:testuser2:rl 
${source}/readable-bucket
-
-Verify Bucket ACL
-    [arguments]         ${source_option}   ${object}    ${type}   ${name}    
${acls}
-    ${actual_acls} =    Execute          ozone sh bucket getacl 
${source_option} ${object} | jq -r '.[] | select(.type == "${type}") | 
select(.name == "${name}") | .aclList[]' | xargs
-                        Should Be Equal    ${acls}    ${actual_acls}
+    Execute Later ozone sh    volume create ${source}
+    Execute Later ozone sh    volume create ${target}
+    Execute Later ozone sh    bucket link ${source}/no-such-bucket 
${target}/dangling-link
+    Execute Later ozone sh    bucket link no-such-volume/no-such-bucket 
${target}/dangling-missing-vol
+    Execute Later ozone sh    bucket link ${target}/dangling-missing-vol 
${target}/link-to-dangling-link
+    Execute Later ozone sh    bucket link ${source}/bucket-in-source 
${target}/link-to-existing-bucket
+    Execute Later ozone sh    bucket create ${source}/bucket-in-source
+    Execute Later ozone sh    bucket create ${target}/bucket-in-target
+
+Setup Secure Tests
+    Return From Keyword If   '${SECURITY_ENABLED}' != 'true'    only if 
security is enabled
+
+    Execute Later ozone sh    bucket create ${source}/readable-bucket
+    Execute Later ozone sh    key put 
${source}/readable-bucket/key-in-readable-bucket /etc/passwd
+    Execute Later ozone sh    bucket create ${source}/unreadable-bucket
+    Execute Later ozone sh    bucket link ${source}/unreadable-bucket 
${target}/link-to-unreadable-bucket
+    Execute Later ozone sh    volume addacl --acl user:testuser2:r[DEFAULT] 
${target}
+    Execute Later ozone sh    bucket link ${source}/readable-bucket 
${target}/readable-link
+    Execute Later ozone sh    volume addacl --acl user:testuser2:rl ${source}
+    Execute Later ozone sh    bucket addacl --acl user:testuser2:rl 
${source}/readable-bucket
+
+Verify ACL in ${file}
+    [arguments]    ${type}    ${name}    ${expected}
+    ${actual} =    Execute    jq -r '.[] | select(.type == "${type}") | 
select(.name == "${name}") | .aclList[]' ${file} | xargs
+    Should Be Equal    ${actual}    ${expected}
+
+Verify ACL of ${object_type} ${object}
+    [arguments]   @{params}    ${source_option}=${EMPTY}
+    ${output_file} =    Execute Later ozone sh    ${object_type} getacl 
${source_option} ${object}
+    Assert Later    Verify ACL in ${output_file}    @{params}
 
 Can follow link with read access
-    Execute             kdestroy
-    Run Keyword         Kinit test user             testuser2         
testuser2.keytab
-    ${result} =         Execute And Ignore Error    ozone sh key list 
${target}/readable-link
-                        Should Contain              ${result}         
key-in-readable-bucket
-    ${result} =         Execute And Ignore Error    ozone sh key list 
${target}/readable-link2
-                        Should Contain              ${result}         
key-in-readable-bucket
+    ${result} =    Execute Later ozone sh    key list ${target}/readable-link
+    Assert Later    File ${result} Should    Contain    key-in-readable-bucket
 
 Cannot follow link without read access
-    Execute             kdestroy
-    Run Keyword         Kinit test user             testuser2         
testuser2.keytab
-    ${result} =         Execute And Ignore Error    ozone sh key list 
${target}/link-to-unreadable-bucket
-                        Should Contain              ${result}         
PERMISSION_DENIED
-    ${result} =         Execute And Ignore Error    ozone sh key list 
${source}/unreadable-bucket
-                        Should Contain              ${result}         
PERMISSION_DENIED
+    ${result} =    Execute Later ozone sh    key list 
${target}/link-to-unreadable-bucket
+    Assert Later    File ${result} Should    Contain    PERMISSION_DENIED
+
+    ${result} =    Execute Later ozone sh    key list 
${source}/unreadable-bucket
+    Assert Later    File ${result} Should    Contain    PERMISSION_DENIED
 
 ACL verified on source and target bucket
-    Execute             kdestroy
-    Run Keyword         Kinit test user             testuser2         
testuser2.keytab
-    ${result} =         Execute                     ozone sh bucket info 
${target}/link-to-unreadable-bucket
-                        Should Contain              ${result}         
link-to-unreadable-bucket
-                        Should Not Contain          ${result}         
PERMISSION_DENIED
-    ${result} =         Execute And Ignore Error    ozone sh bucket info 
${source}/unreadable-bucket
-                        Should Contain              ${result}         
PERMISSION_DENIED
+    ${result} =    Execute Later ozone sh    bucket info 
${target}/link-to-unreadable-bucket
+    Assert Later    File ${result} Should
+    ...    Contain    link-to-unreadable-bucket
+    ...    Not Contain    PERMISSION_DENIED
+
+    ${result} =    Execute Later ozone sh    bucket info 
${source}/unreadable-bucket
+    Assert Later    File ${result} Should    Contain    PERMISSION_DENIED
 
 Create link loop
-    Run Keyword if      '${SECURITY_ENABLED}' == 'true'    Kinit test user     
testuser     testuser.keytab
-                        Ozone Shell Batch   bucket link ${target}/loop1 
${target}/loop2
-                        ...                 bucket link ${target}/loop2 
${target}/loop3
-                        ...                 bucket link ${target}/loop3 
${target}/loop1
+    Execute Later ozone sh    bucket link ${target}/loop1 ${target}/loop2
+    Execute Later ozone sh    bucket link ${target}/loop2 ${target}/loop3
+    Execute Later ozone sh    bucket link ${target}/loop3 ${target}/loop1
 
 Delete link loop
-                        Ozone Shell Batch   bucket delete ${target}/loop1
-                        ...                 bucket delete ${target}/loop2
-                        ...                 bucket delete ${target}/loop3
+    Execute Later ozone sh    bucket delete ${target}/loop1
+    Execute Later ozone sh    bucket delete ${target}/loop2
+    Execute Later ozone sh    bucket delete ${target}/loop3
+
+Put and get key
+    [arguments]    ${put_to}    ${get_from}    ${put_from}=/etc/passwd
+    ${get_to} =    Get Next Filename    ${TEMP_DIR}/key-get
+    Execute Later ozone sh    key put ${put_to} ${put_from}
+    Execute Later ozone sh    key get -f ${get_from} ${get_to}
+    Assert Later    Compare Files    ${put_from}    ${get_to}
+
 
 *** Test Cases ***
 Link to non-existent bucket
-                        Execute                     ozone sh bucket link 
${source}/no-such-bucket ${target}/dangling-link
-    ${result} =         Execute And Ignore Error    ozone sh key list 
${target}/dangling-link
-                        Should Contain              ${result}         
BUCKET_NOT_FOUND
-                        Should Contain              ${result}         Cannot 
follow bucket link
+    ${result} =    Execute Later ozone sh    key list ${target}/dangling-link
+    Assert Later    File ${result} Should
+    ...    Contain    BUCKET_NOT_FOUND
+    ...    Contain    Cannot follow bucket link
 
 Link to non-existent source volume
-                        Execute                     ozone sh bucket link 
no-such-volume/no-such-bucket ${target}/dangling-missing-vol
-    ${result} =         Execute And Ignore Error    ozone sh key list 
${target}/dangling-missing-vol
-                        Should Contain              ${result}         
VOLUME_NOT_FOUND
-                        Should Contain              ${result}         Cannot 
follow bucket link
+    ${result} =    Execute Later ozone sh    key list 
${target}/dangling-missing-vol
+    Assert Later    File ${result} Should
+    ...    Contain    VOLUME_NOT_FOUND
+    ...    Contain    Cannot follow bucket link
 
 Link chain to broken source
-                        Execute                     ozone sh bucket link 
no-such-volume/no-such-bucket ${target}/link-bucket2
-                        Execute                     ozone sh bucket link 
${target}/link-bucket2 ${target}/link-bucket1
-    ${result} =         Execute And Ignore Error    ozone sh key list 
${target}/link-bucket1
-                        Should Contain              ${result}         
VOLUME_NOT_FOUND
-                        Should Contain              ${result}         Cannot 
follow bucket link
+    ${result} =    Execute Later ozone sh    key list 
${target}/link-to-dangling-link
+    Assert Later    File ${result} Should
+    ...    Contain    VOLUME_NOT_FOUND
+    ...    Contain    Cannot follow bucket link
 
 Key create passthrough
-                        Ozone Shell Batch           bucket link 
${source}/bucket1 ${target}/link1
-                        ...                         bucket create 
${source}/bucket1
-                        ...                         key put 
${target}/link1/key1 /etc/passwd
-                        Key Should Match Local File     ${target}/link1/key1   
 /etc/passwd
+    # put to link, get from bucket
+    Put and get key    put_to=${target}/link-to-existing-bucket/key1    
get_from=${source}/bucket-in-source/key1
 
 Key read passthrough
-                        Execute                     ozone sh key put 
${source}/bucket1/key2 /opt/hadoop/NOTICE.txt
-                        Key Should Match Local File     ${source}/bucket1/key2 
   /opt/hadoop/NOTICE.txt
+    # put to bucket, get from link
+    Put and get key    put_to=${source}/bucket-in-source/key2    
get_from=${target}/link-to-existing-bucket/key2
 
 Key list passthrough
-    ${target_list} =    Execute                     ozone sh key list 
${target}/link1 | jq -r '.[].name'
-    ${source_list} =    Execute                     ozone sh key list 
${source}/bucket1 | jq -r '.[].name'
-                        Should Be Equal             ${target_list}    
${source_list}
-                        Should Contain              ${source_list}    key1
-                        Should Contain              ${source_list}    key2
+    ${target_list} =    Execute Later ozone sh    key list 
${target}/link-to-existing-bucket
+    ${source_list} =    Execute Later ozone sh    key list 
${source}/bucket-in-source
+    Assert Later    Compare files    ${source_list}    ${target_list}
+    Assert Later    File ${source_list} Should
+    ...    Contain    key1
+    ...    Contain    key2
 
 Key delete passthrough
-                        Execute                     ozone sh key delete 
${target}/link1/key2
-    ${bucket1keys} =    Execute                     ozone sh key list 
${source}/bucket1
-    ${source_list} =    Execute                     echo '${bucket1keys}' | jq 
-r '.[] | select(.name | startswith(".Trash")) | .name'
-                        Should Contain Any          ${source_list}    
.Trash/hadoop    .Trash/testuser    .Trash/root
-                        Should contain              ${source_list}    key2
-    ${result} =         Execute                     echo '${bucket1keys}' | jq 
-r '.[] | select(.name | startswith(".Trash") | not) | .name'
-                        Should Not contain          ${result}    key2
+    Execute Later ozone sh    key delete ${target}/link-to-existing-bucket/key2
+    ${delete} =    Execute Later ozone sh    key list --all --prefix .Trash 
${source}/bucket-in-source
+    ${retain} =    Execute Later ozone sh    key list --all --prefix key 
${source}/bucket-in-source
+    Assert Later   File ${delete} Should    Contain    key2
+    Assert Later   File ${retain} Should    Not Contain    key2
 
 Bucket list contains links
-    ${result} =         Execute                     ozone sh bucket list 
${target}
-                        Should Contain              ${result}         link1
-                        Should Contain              ${result}         
dangling-link
+    ${result} =    Execute Later ozone sh    bucket list ${target}
+    Assert Later    File ${result} Should
+    ...    Contain    link-to-existing-bucket
+    ...    Contain    dangling-link
 
 Bucket info shows source
-    ${result} =         Execute                     ozone sh bucket info 
${target}/link1
-                        Should Contain              ${result}            
${source}
-                        Should Contain              ${result}            
bucket1
-                        Should Contain              ${result}            
${target}
-                        Should Contain              ${result}            link1
-                        Should Contain              ${result}            
modificationTime
-                        Should Contain              ${result}            
creationTime
-                        Should Not contain          ${result}            
metadata
+    ${result} =    Execute Later ozone sh    bucket info 
${target}/link-to-existing-bucket
+    Assert Later    File ${result} Should
+    ...    Contain    ${source}
+    ...    Contain    bucket-in-source
+    ...    Contain    ${target}
+    ...    Contain    link-to-existing-bucket
+    ...    Contain    modificationTime
+    ...    Contain    creationTime
+    ...    Not Contain    metadata
 
 Source and target bucket have different ACLs
-    Execute             ozone sh bucket addacl --acl user:user1:rwxy 
${target}/link1
-    Verify ACL          bucket          ${target}/link1      USER    user1    
${EMPTY}
-    Verify Bucket ACL   --source=false  ${target}/link1      USER    user1    
${EMPTY}
-    Verify Bucket ACL   --source        ${target}/link1      USER    user1    
READ WRITE READ_ACL WRITE_ACL
-    Verify ACL          bucket          ${source}/bucket1    USER    user1    
READ WRITE READ_ACL WRITE_ACL
+    Execute Later ozone sh    bucket addacl --acl user:user1:rwxy 
${target}/link-to-existing-bucket
+    Verify ACL of bucket ${target}/link-to-existing-bucket    USER    user1    
${EMPTY}
+    Verify ACL of bucket ${target}/link-to-existing-bucket    USER    user1    
${EMPTY}    source_option=--source=false
+    Verify ACL of bucket ${target}/link-to-existing-bucket    USER    user1    
READ WRITE READ_ACL WRITE_ACL    source_option=--source
+    Verify ACL of bucket ${source}/bucket-in-source    USER    user1    READ 
WRITE READ_ACL WRITE_ACL
 
-    Execute             ozone sh bucket removeacl --acl user:user1:y 
${target}/link1
-    Verify ACL          bucket          ${target}/link1      USER    user1    
${EMPTY}
-    Verify Bucket ACL   --source        ${target}/link1      USER    user1    
READ WRITE READ_ACL
+    Execute Later ozone sh    bucket removeacl --acl user:user1:y 
${target}/link-to-existing-bucket
+    Verify ACL of bucket ${target}/link-to-existing-bucket    USER    user1    
${EMPTY}
+    Verify ACL of bucket ${target}/link-to-existing-bucket    USER    user1    
READ WRITE READ_ACL    source_option=--source
 
-    Execute             ozone sh bucket setacl --acl user:user1:rw 
${source}/bucket1
-    Verify ACL          bucket          ${target}/link1      USER    user1    
${EMPTY}
-    Verify Bucket ACL   --source        ${target}/link1      USER    user1    
READ WRITE
+    Execute Later ozone sh    bucket setacl --acl user:user1:rw 
${source}/bucket-in-source
+    Verify ACL of bucket ${target}/link-to-existing-bucket    USER    user1    
${EMPTY}
+    Verify ACL of bucket ${target}/link-to-existing-bucket    USER    user1    
READ WRITE    source_option=--source
 
-    Execute             ozone sh bucket addacl --acl group:group2:r 
${source}/bucket1
-    Verify ACL          bucket          ${target}/link1      GROUP   group2    
${EMPTY}
-    Verify Bucket ACL   --source        ${target}/link1      GROUP   group2    
READ
+    Execute Later ozone sh    bucket addacl --acl group:group2:r 
${source}/bucket-in-source
+    Verify ACL of bucket ${target}/link-to-existing-bucket    GROUP   group2   
 ${EMPTY}
+    Verify ACL of bucket ${target}/link-to-existing-bucket    GROUP   group2   
 READ    source_option=--source
 
 Source and target key have same ACLs
-    Execute             ozone sh key addacl --acl user:user1:rwxy 
${source}/bucket1/key1
-    Verify ACL          key       ${target}/link1/key1     USER    user1    
READ WRITE READ_ACL WRITE_ACL
-    Verify ACL          key       ${source}/bucket1/key1   USER    user1    
READ WRITE READ_ACL WRITE_ACL
-    Execute             ozone sh key removeacl --acl user:user1:y 
${target}/link1/key1
-    Verify ACL          key       ${target}/link1/key1     USER    user1    
READ WRITE READ_ACL
-    Verify ACL          key       ${source}/bucket1/key1   USER    user1    
READ WRITE READ_ACL
-    Execute             ozone sh key setacl --acl user:user1:rw 
${source}/bucket1/key1
-    Verify ACL          key       ${target}/link1/key1     USER    user1    
READ WRITE
-    Verify ACL          key       ${source}/bucket1/key1   USER    user1    
READ WRITE
-
-    Execute             ozone sh key addacl --acl group:group2:r 
${source}/bucket1/key1
-    Verify ACL          key    ${target}/link1/key1     GROUP   group2    READ
-    Verify ACL          key    ${source}/bucket1/key1   GROUP   group2    READ
+    Execute Later ozone sh    key addacl --acl user:user1:rwxy 
${source}/bucket-in-source/key1
+    Verify ACL of key ${target}/link-to-existing-bucket/key1    USER    user1  
  READ WRITE READ_ACL WRITE_ACL
+    Verify ACL of key ${source}/bucket-in-source/key1   USER    user1    READ 
WRITE READ_ACL WRITE_ACL
+
+    Execute Later ozone sh    key removeacl --acl user:user1:y 
${target}/link-to-existing-bucket/key1
+    Verify ACL of key ${target}/link-to-existing-bucket/key1    USER    user1  
  READ WRITE READ_ACL
+    Verify ACL of key ${source}/bucket-in-source/key1   USER    user1    READ 
WRITE READ_ACL
+
+    Execute Later ozone sh    key setacl --acl user:user1:rw 
${source}/bucket-in-source/key1
+    Verify ACL of key ${target}/link-to-existing-bucket/key1    USER    user1  
  READ WRITE
+    Verify ACL of key ${source}/bucket-in-source/key1   USER    user1    READ 
WRITE
+
+    Execute Later ozone sh    key addacl --acl group:group2:r 
${source}/bucket-in-source/key1
+    Verify ACL of key ${target}/link-to-existing-bucket/key1    GROUP   group2 
   READ
+    Verify ACL of key ${source}/bucket-in-source/key1   GROUP   group2    READ
 
 Source and target prefix have same ACLs
-    Execute             ozone sh prefix addacl --acl user:user1:rwxy 
${source}/bucket1/prefix1/
-    Verify ACL          prefix       ${target}/link1/prefix1/     USER    
user1    READ WRITE READ_ACL WRITE_ACL
-    Verify ACL          prefix       ${source}/bucket1/prefix1/   USER    
user1    READ WRITE READ_ACL WRITE_ACL
-    Execute             ozone sh prefix removeacl --acl user:user1:y 
${target}/link1/prefix1/
-    Verify ACL          prefix       ${target}/link1/prefix1/     USER    
user1    READ WRITE READ_ACL
-    Verify ACL          prefix       ${source}/bucket1/prefix1/   USER    
user1    READ WRITE READ_ACL
-    Execute             ozone sh prefix setacl --acl user:user1:rw 
${source}/bucket1/prefix1/
-    Verify ACL          prefix       ${target}/link1/prefix1/     USER    
user1    READ WRITE
-    Verify ACL          prefix       ${source}/bucket1/prefix1/   USER    
user1    READ WRITE
-
-    Execute             ozone sh prefix addacl --acl group:group2:r 
${source}/bucket1/prefix1/
-    Verify ACL          prefix       ${target}/link1/prefix1/     GROUP   
group2    READ
-    Verify ACL          prefix       ${source}/bucket1/prefix1/   GROUP   
group2    READ
+    Execute Later ozone sh    prefix addacl --acl user:user1:rwxy 
${source}/bucket-in-source/prefix1/
+    Verify ACL of prefix ${target}/link-to-existing-bucket/prefix1/    USER    
user1    READ WRITE READ_ACL WRITE_ACL
+    Verify ACL of prefix ${source}/bucket-in-source/prefix1/   USER    user1   
 READ WRITE READ_ACL WRITE_ACL
 
-Buckets and links share namespace
-                        Execute                     ozone sh bucket link 
${source}/bucket2 ${target}/link2
-    ${result} =         Execute And Ignore Error    ozone sh bucket create 
${target}/link2
-                        Should Contain              ${result}    
BUCKET_ALREADY_EXISTS
+    Execute Later ozone sh    prefix removeacl --acl user:user1:y 
${target}/link-to-existing-bucket/prefix1/
+    Verify ACL of prefix ${target}/link-to-existing-bucket/prefix1/    USER    
user1    READ WRITE READ_ACL
+    Verify ACL of prefix ${source}/bucket-in-source/prefix1/   USER    user1   
 READ WRITE READ_ACL
 
-                        Execute                     ozone sh bucket create 
${target}/bucket3
-    ${result} =         Execute And Ignore Error    ozone sh bucket link 
${source}/bucket1 ${target}/bucket3
-                        Should Contain              ${result}    
BUCKET_ALREADY_EXISTS
+    Execute Later ozone sh    prefix setacl --acl user:user1:rw 
${source}/bucket-in-source/prefix1/
+    Verify ACL of prefix ${target}/link-to-existing-bucket/prefix1/    USER    
user1    READ WRITE
+    Verify ACL of prefix ${source}/bucket-in-source/prefix1/   USER    user1   
 READ WRITE
 
-Can follow link with read access
-    Run Keyword if    '${SECURITY_ENABLED}' == 'true'    Can follow link with 
read access
+    Execute Later ozone sh    prefix addacl --acl group:group2:r 
${source}/bucket-in-source/prefix1/
+    Verify ACL of prefix ${target}/link-to-existing-bucket/prefix1/    GROUP   
group2    READ
+    Verify ACL of prefix ${source}/bucket-in-source/prefix1/   GROUP   group2  
  READ
 
-Cannot follow link without read access
-    Run Keyword if    '${SECURITY_ENABLED}' == 'true'    Cannot follow link 
without read access
+Buckets and links share namespace
+    ${result} =    Execute Later ozone sh    bucket create 
${target}/link-to-existing-bucket
+    Assert Later    File ${result} Should    Contain    BUCKET_ALREADY_EXISTS
 
-ACL verified on source and target bucket
-    Run Keyword if    '${SECURITY_ENABLED}' == 'true'    ACL verified on 
source and target bucket
+    ${result} =    Execute Later ozone sh    bucket create 
${target}/dangling-link
+    Assert Later    File ${result} Should    Contain    BUCKET_ALREADY_EXISTS
+
+    ${result} =    Execute Later ozone sh    bucket link 
${source}/bucket-in-source ${target}/bucket-in-target
+    Assert Later    File ${result} Should    Contain    BUCKET_ALREADY_EXISTS
 
 Loop in link chain is detected
-    [setup]             Create link loop
-    ${result} =         Execute And Ignore Error    ozone sh key list 
${target}/loop2
-                        Should Contain              ${result}    DETECTED_LOOP
-    [teardown]          Delete link loop
+    [setup]    Create link loop
+    ${result} =    Execute Later ozone sh    key list ${target}/loop2
+    Assert Later    File ${result} Should    Contain    DETECTED_LOOP
+    [teardown]    Delete link loop
 
 Multiple links to same bucket are allowed
-    Ozone Shell Batch               bucket link ${source}/bucket1 
${target}/link3
-    ...                             key put ${target}/link3/key3 /etc/group
-    Key Should Match Local File     ${target}/link1/key3    /etc/group
+    Execute Later ozone sh    bucket link ${source}/bucket-in-source 
${target}/another-link
+    Put and get key    put_to=${target}/another-link/key3    
get_from=${target}/link-to-existing-bucket/key3    put_from=/etc/group
+    Put and get key    put_to=${target}/link-to-existing-bucket/key4    
get_from=${target}/another-link/key4    put_from=/etc/hostname
 
 Source bucket not affected by deleting link
-                        Execute                     ozone sh bucket delete 
${target}/link1
-    ${bucket_list} =    Execute                     ozone sh bucket list 
${target}
-                        Should Not Contain          ${bucket_list}    link1
-    ${source_list} =    Execute                     ozone sh key list 
${source}/bucket1 | jq -r '.[].name'
-                        Should Contain              ${source_list}    key1
+    Execute Later ozone sh    bucket link ${source}/bucket-in-source 
${target}/link-to-be-deleted
+    Execute Later ozone sh    bucket delete ${target}/link-to-be-deleted
+
+    ${buckets_in_target} =    Execute Later ozone sh    bucket list ${target}
+    Assert Later    File ${buckets_in_target} Should    Not Contain    
link-to-be-deleted
+
+    ${keys_in_source} =    Execute Later ozone sh    key list 
${source}/bucket-in-source
+    Assert Later    File ${keys_in_source} Should    Contain    key3
 
 Setting bucket property on link not allowed
-                        Execute                     ozone sh bucket link 
${source}/bucket1 ${target}/link4
-    ${result} =         Execute And Ignore Error    ozone sh bucket setquota 
${target}/link4 --quota 1GB
-                        Should Contain              ${result}    
NOT_SUPPORTED_OPERATION
-    ${result} =         Execute                     ozone sh bucket info 
${target}/link4
-                        Should Contain              ${result}            
sourceBucket
+    ${result} =    Execute Later ozone sh    bucket setquota 
${target}/link-to-existing-bucket --quota 1GB
+    Assert Later    File ${result} Should    Contain    NOT_SUPPORTED_OPERATION
+
+Bucket info for link contains source
+    ${result} =    Execute Later ozone sh    bucket info 
${target}/link-to-existing-bucket
+    Assert Later    File ${result} Should    Contain    sourceBucket
+
+Execute Batch for testuser
+    Execute Batch
+
+Test with other user
+    Skip If   '${SECURITY_ENABLED}' != 'true'    only if security is enabled
+
+    Execute    kdestroy
+    Run Keyword    Kinit test user    testuser2    testuser2.keytab
+
+    Can follow link with read access
+    Cannot follow link without read access
+    ACL verified on source and target bucket
+
+    Execute Batch
diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot 
b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
index 7affbcba16c..737a76c66a3 100644
--- a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
@@ -33,6 +33,9 @@ Generate prefix
 
 Test ozone shell
     [arguments]     ${protocol}         ${server}       ${volume}
+
+    Kinit test user
+
     ${result} =     Execute and checkrc    ozone sh volume info 
${protocol}${server}/${volume}      255
                     Should contain      ${result}       VOLUME_NOT_FOUND
     ${result} =     Execute             ozone sh volume create 
${protocol}${server}/${volume} --space-quota 100TB --namespace-quota 100
diff --git a/hadoop-ozone/dist/src/main/smoketest/commonlib.robot 
b/hadoop-ozone/dist/src/main/smoketest/commonlib.robot
index 3df0b2ba01b..fc75d3a610e 100644
--- a/hadoop-ozone/dist/src/main/smoketest/commonlib.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/commonlib.robot
@@ -45,9 +45,9 @@ Kinit HTTP user
     Wait Until Keyword Succeeds      2min       10sec      Execute            
kinit -k -t /etc/security/keytabs/HTTP.keytab ${principal}
 
 Kinit test user
+    [arguments]    ${user}=testuser    ${keytab}=testuser.keytab
     Get Security Enabled From Config
-    Pass Execution If   '${SECURITY_ENABLED}' == 'false'    Skip in unsecure 
cluster
-    [arguments]                      ${user}       ${keytab}
+    Return From Keyword If   '${SECURITY_ENABLED}' != 'true'    only if 
security is enabled
     ${TEST_USER} =      Get test user principal    ${user}
     Set Suite Variable  ${TEST_USER}
     Wait Until Keyword Succeeds      2min       10sec      Execute            
kinit -k -t /etc/security/keytabs/${keytab} ${TEST_USER}
diff --git a/hadoop-ozone/dist/src/main/smoketest/lib/os.robot 
b/hadoop-ozone/dist/src/main/smoketest/lib/os.robot
index 98f836ff8bf..2597c4f9956 100644
--- a/hadoop-ozone/dist/src/main/smoketest/lib/os.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/lib/os.robot
@@ -66,3 +66,12 @@ Get Random Filename
 List All Processes
     ${output} =    Execute    ps aux
     [return]    ${output}
+
+File ${file} Should
+    [arguments]    @{args}
+    File Should Exist    ${file}
+    ${content} =    Get File    ${file}
+    Log    ${content}
+    FOR    ${keyword}    ${arg}    IN    @{args}
+        Run Keyword    Should ${keyword}    ${content}    ${arg}
+    END
diff --git a/hadoop-ozone/dist/src/main/smoketest/ozone-lib/batch.robot 
b/hadoop-ozone/dist/src/main/smoketest/ozone-lib/batch.robot
new file mode 100644
index 00000000000..6b7600fb094
--- /dev/null
+++ b/hadoop-ozone/dist/src/main/smoketest/ozone-lib/batch.robot
@@ -0,0 +1,116 @@
+# 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       Execute ozone commands in batch
+Library             Collections
+Library             OperatingSystem
+Resource            ../lib/os.robot
+Resource            ../ozone-lib/shell.robot
+
+
+*** Keywords ***
+Setup Batch
+    Init Batch
+    Set Suite Variable    ${BATCH_OUTPUT_FILE_COUNTER}    0
+    ${BATCH_OUTPUT_DIR} =    Get Next Filename    ${TEMP_DIR}/batch
+    Set Suite Variable    ${BATCH_OUTPUT_DIR}
+    Create Directory      ${BATCH_OUTPUT_DIR}
+
+
+Teardown Batch
+    Execute Batch
+    Remove Directory    ${BATCH_OUTPUT_DIR}    recursive=True
+
+
+Init Batch
+    Set Suite Variable    ${BATCH_SUBCMD}    ${EMPTY}
+    Set Suite Variable    @{BATCH_COMMANDS}    @{EMPTY}
+    Set Suite Variable    ${BATCH_QUEUEING}    ${FALSE}
+    Set Suite Variable    @{BATCH_ASSERTIONS}    @{EMPTY}
+
+
+# get unique name using ${BATCH_OUTPUT_FILE_COUNTER}
+Get Next Filename
+    [arguments]    ${prefix}
+    ${i} =    Set Variable    ${BATCH_OUTPUT_FILE_COUNTER}
+    ${i} =    Evaluate    ${i} + 1
+    Set Suite Variable    ${BATCH_OUTPUT_FILE_COUNTER}    ${i}
+    [return]    ${prefix}-${i}
+
+
+# queue ozone command for batch execution
+# return path where output will be available
+Execute Later ozone ${subcmd}
+    [arguments]    ${command}
+
+    IF    '${BATCH_SUBCMD}' != '${EMPTY}' and '${subcmd}' != '${BATCH_SUBCMD}'
+        Execute Batch
+    END
+
+    TRY
+        ${test_name} =    Set Variable    ${TEST_NAME}
+    EXCEPT
+        ${test_name} =    Set Variable    Suite Setup
+    END
+
+    ${output_file} =    Get Next Filename    
${BATCH_OUTPUT_DIR}/out-ozone-${subcmd}
+    ${cmd_with_redirection} =    Set Variable    ${command} > ${output_file}
+
+    ${debug_comment} =    Set Variable    \# ${test_name}
+    Append To List    ${BATCH_COMMANDS}    ${debug_comment}
+    Append To List    ${BATCH_COMMANDS}    ${cmd_with_redirection}
+    Set Suite Variable    ${BATCH_QUEUEING}    ${TRUE}
+    Set Suite Variable    ${BATCH_SUBCMD}    ${subcmd}
+    Log    Output of test ${test_name} command ${command} redirected to 
${output_file}
+
+    RETURN    ${output_file}
+
+
+# queue keyword execution for batch execution after all tests
+Assert Later
+    [arguments]    @{assertion}
+
+    IF    '${BATCH_QUEUEING}' == '${TRUE}'
+        &{test_case} =   Create Dictionary    name=${TEST_NAME}    
assertions=${assertion}
+        Append To List    ${BATCH_ASSERTIONS}    ${test_case}
+    ELSE
+        Run Keyword    @{assertion}
+    END
+
+
+Execute Batch of Commands
+    IF    '${BATCH_SUBCMD}' == '${EMPTY}'    RETURN
+    Run Keyword    Ozone Batch ${BATCH_SUBCMD}    @{BATCH_COMMANDS}
+    [teardown]    Set Suite Variable    @{BATCH_COMMANDS}    @{EMPTY}
+
+
+Execute Batch of Assertions
+    FOR    ${test_case}    IN    @{BATCH_ASSERTIONS}
+        Log    Executing assertions for: ${test_case.name}
+        FOR    ${a}    IN     ${test_case.assertions}
+            TRY
+                Run Keyword    @{a}
+            EXCEPT    AS    ${error}
+                Fail    ${test_case.name} failed at @{a}: ${error}
+            END
+        END
+    END
+    [teardown]    Set Suite Variable    @{BATCH_ASSERTIONS}    @{EMPTY}
+
+
+Execute Batch
+    Execute Batch of Commands
+    Execute Batch of Assertions
diff --git a/hadoop-ozone/dist/src/main/smoketest/ozone-lib/shell.robot 
b/hadoop-ozone/dist/src/main/smoketest/ozone-lib/shell.robot
index aa288ed8656..77843cdac80 100644
--- a/hadoop-ozone/dist/src/main/smoketest/ozone-lib/shell.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/ozone-lib/shell.robot
@@ -24,6 +24,13 @@ Ozone Shell Batch
     ${cmd} =    Catenate    SEPARATOR=' --execute '    @{commands}
     Run Keyword And Return    Execute and checkrc    ozone sh --execute 
'${cmd}'    0
 
+Ozone Batch ${subcmd}
+    [arguments]    @{commands}
+    ${cmd} =    Catenate    SEPARATOR=' --execute '    @{commands}
+    Run    ozone ${subcmd} --continue-batch-on-error --execute '${cmd}' &> 
${TEMP_DIR}/batch.out
+    ${output} =    Get File    ${TEMP_DIR}/batch.out
+    Log    ${output}
+
 Bucket Exists
     [arguments]    ${bucket}
     ${rc}    ${output} =      Run And Return Rc And Output             timeout 
15 ozone sh bucket info ${bucket}
@@ -52,11 +59,6 @@ File Should Match Local File
     ${matches} =   Compare Key With Local File    ${key}    ${file}    fs -get
     Should Be True    ${matches}
 
-Verify ACL
-    [arguments]         ${object_type}   ${object}    ${type}   ${name}    
${acls}
-    ${actual_acls} =    Execute          ozone sh ${object_type} getacl 
${object} | jq -r '.[] | select(.type == "${type}") | select(.name == 
"${name}") | .aclList[]' | xargs
-                        Should Be Equal    ${acls}    ${actual_acls}
-
 Create Random Volume
     ${random} =    Generate Random String  5  [LOWER]
     Execute        ozone sh volume create o3://${OM_SERVICE_ID}/vol-${random}


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

Reply via email to