ozone-shell.robot 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Licensed to the Apache Software Foundation (ASF) under one or more
  2. # contributor license agreements. See the NOTICE file distributed with
  3. # this work for additional information regarding copyright ownership.
  4. # The ASF licenses this file to You under the Apache License, Version 2.0
  5. # (the "License"); you may not use this file except in compliance with
  6. # the License. You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. *** Settings ***
  16. Documentation Test ozone shell CLI usage
  17. Library OperatingSystem
  18. Resource ../commonlib.robot
  19. Test Timeout 2 minute
  20. *** Variables ***
  21. *** Test Cases ***
  22. RpcClient with port
  23. Test ozone shell o3:// om:9862 rpcwoport
  24. RpcClient volume acls
  25. Test Volume Acls o3:// om:9862 rpcwoport2
  26. RpcClient bucket acls
  27. Test Bucket Acls o3:// om:9862 rpcwoport2
  28. RpcClient key acls
  29. Test Key Acls o3:// om:9862 rpcwoport2
  30. RpcClient without host
  31. Test ozone shell o3:// ${EMPTY} rpcwport
  32. RpcClient without scheme
  33. Test ozone shell ${EMPTY} ${EMPTY} rpcwoscheme
  34. *** Keywords ***
  35. Test ozone shell
  36. [arguments] ${protocol} ${server} ${volume}
  37. ${result} = Execute ozone sh volume create ${protocol}${server}/${volume} --quota 100TB
  38. Should not contain ${result} Failed
  39. Should contain ${result} Creating Volume: ${volume}
  40. ${result} = Execute ozone sh volume list ${protocol}${server}/ | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.volumeName=="${volume}")'
  41. Should contain ${result} createdOn
  42. ${result} = Execute ozone sh volume list | grep -Ev 'Removed|DEBUG|ERROR|INFO|TRACE|WARN' | jq -r '.[] | select(.volumeName=="${volume}")'
  43. Should contain ${result} createdOn
  44. # TODO: Disable updating the owner, acls should be used to give access to other user.
  45. Execute ozone sh volume update ${protocol}${server}/${volume} --quota 10TB
  46. # ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .owner | .name'
  47. # Should Be Equal ${result} bill
  48. ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .quota | .size'
  49. Should Be Equal ${result} 10
  50. Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1
  51. ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .storageType'
  52. Should Be Equal ${result} DISK
  53. ${result} = Execute ozone sh bucket list ${protocol}${server}/${volume}/ | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.bucketName=="bb1") | .volumeName'
  54. Should Be Equal ${result} ${volume}
  55. Run Keyword Test key handling ${protocol} ${server} ${volume}
  56. Execute ozone sh bucket delete ${protocol}${server}/${volume}/bb1
  57. Execute ozone sh volume delete ${protocol}${server}/${volume}
  58. Test Volume Acls
  59. [arguments] ${protocol} ${server} ${volume}
  60. Execute ozone sh volume create ${protocol}${server}/${volume}
  61. ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume}
  62. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" .
  63. ${result} = Execute ozone sh volume addacl ${protocol}${server}/${volume} -a user:superuser1:rwxy[DEFAULT]
  64. ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume}
  65. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" .
  66. ${result} = Execute ozone sh volume removeacl ${protocol}${server}/${volume} -a user:superuser1:xy
  67. ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume}
  68. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" .
  69. ${result} = Execute ozone sh volume setacl ${protocol}${server}/${volume} -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc,group:superuser1:a[DEFAULT]
  70. ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume}
  71. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" .
  72. Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"ALL\" .
  73. Test Bucket Acls
  74. [arguments] ${protocol} ${server} ${volume}
  75. Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1
  76. ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1
  77. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" .
  78. ${result} = Execute ozone sh bucket addacl ${protocol}${server}/${volume}/bb1 -a user:superuser1:rwxy
  79. ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1
  80. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
  81. ${result} = Execute ozone sh bucket removeacl ${protocol}${server}/${volume}/bb1 -a user:superuser1:xy
  82. ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1
  83. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\"
  84. ${result} = Execute ozone sh bucket setacl ${protocol}${server}/${volume}/bb1 -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc,group:superuser1:a[DEFAULT]
  85. ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1
  86. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
  87. Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"ALL\" .
  88. Test key handling
  89. [arguments] ${protocol} ${server} ${volume}
  90. Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key1 /opt/hadoop/NOTICE.txt
  91. Execute rm -f NOTICE.txt.1
  92. Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1 NOTICE.txt.1
  93. Execute ls -l NOTICE.txt.1
  94. ${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.keyName=="key1")'
  95. Should contain ${result} createdOn
  96. ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.keyName=="key1") | .keyName'
  97. Should Be Equal ${result} key1
  98. Execute ozone sh key rename ${protocol}${server}/${volume}/bb1 key1 key2
  99. ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[].keyName'
  100. Should Be Equal ${result} key2
  101. Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key2
  102. Test key Acls
  103. [arguments] ${protocol} ${server} ${volume}
  104. Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key2 /opt/hadoop/NOTICE.txt
  105. ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2
  106. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" .
  107. ${result} = Execute ozone sh key addacl ${protocol}${server}/${volume}/bb1/key2 -a user:superuser1:rwxy
  108. ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2
  109. Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
  110. ${result} = Execute ozone sh key removeacl ${protocol}${server}/${volume}/bb1/key2 -a user:superuser1:xy
  111. ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2
  112. Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\"
  113. ${result} = Execute ozone sh key setacl ${protocol}${server}/${volume}/bb1/key2 -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc
  114. ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2
  115. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
  116. Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" .