ozone-shell.robot 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 Setup Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab
  20. Test Timeout 2 minute
  21. *** Variables ***
  22. *** Test Cases ***
  23. RpcClient with port
  24. Test ozone shell o3:// om:9862 rpcwoport
  25. RpcClient volume acls
  26. Test Volume Acls o3:// om:9862 rpcwoport2
  27. RpcClient bucket acls
  28. Test Bucket Acls o3:// om:9862 rpcwoport2
  29. RpcClient key acls
  30. Test Key Acls o3:// om:9862 rpcwoport2
  31. RpcClient without host
  32. Test ozone shell o3:// ${EMPTY} rpcwport
  33. RpcClient without scheme
  34. Test ozone shell ${EMPTY} ${EMPTY} rpcwoscheme
  35. *** Keywords ***
  36. Test ozone shell
  37. [arguments] ${protocol} ${server} ${volume}
  38. ${result} = Execute ozone sh volume create ${protocol}${server}/${volume} --quota 100TB
  39. Should not contain ${result} Failed
  40. Should contain ${result} Creating Volume: ${volume}
  41. ${result} = Execute ozone sh volume list ${protocol}${server}/ | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.volumeName=="${volume}")'
  42. Should contain ${result} createdOn
  43. ${result} = Execute ozone sh volume list | grep -Ev 'Removed|DEBUG|ERROR|INFO|TRACE|WARN' | jq -r '.[] | select(.volumeName=="${volume}")'
  44. Should contain ${result} createdOn
  45. # TODO: Disable updating the owner, acls should be used to give access to other user.
  46. Execute ozone sh volume update ${protocol}${server}/${volume} --quota 10TB
  47. # ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .owner | .name'
  48. # Should Be Equal ${result} bill
  49. ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .quota | .size'
  50. Should Be Equal ${result} 10
  51. Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1
  52. ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .storageType'
  53. Should Be Equal ${result} DISK
  54. ${result} = Execute ozone sh bucket list ${protocol}${server}/${volume}/ | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.bucketName=="bb1") | .volumeName'
  55. Should Be Equal ${result} ${volume}
  56. Run Keyword Test key handling ${protocol} ${server} ${volume}
  57. Execute ozone sh bucket delete ${protocol}${server}/${volume}/bb1
  58. Execute ozone sh volume delete ${protocol}${server}/${volume}
  59. Test Volume Acls
  60. [arguments] ${protocol} ${server} ${volume}
  61. Execute ozone sh volume create ${protocol}${server}/${volume}
  62. ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume}
  63. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" .
  64. ${result} = Execute ozone sh volume addacl ${protocol}${server}/${volume} -a user:superuser1:rwxy[DEFAULT]
  65. ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume}
  66. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" .
  67. ${result} = Execute ozone sh volume removeacl ${protocol}${server}/${volume} -a user:superuser1:xy
  68. ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume}
  69. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" .
  70. ${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]
  71. ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume}
  72. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" .
  73. Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"ALL\" .
  74. Test Bucket Acls
  75. [arguments] ${protocol} ${server} ${volume}
  76. Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1
  77. ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1
  78. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" .
  79. ${result} = Execute ozone sh bucket addacl ${protocol}${server}/${volume}/bb1 -a user:superuser1:rwxy
  80. ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1
  81. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
  82. ${result} = Execute ozone sh bucket removeacl ${protocol}${server}/${volume}/bb1 -a user:superuser1:xy
  83. ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1
  84. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\"
  85. ${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]
  86. ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1
  87. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
  88. Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"ALL\" .
  89. Test key handling
  90. [arguments] ${protocol} ${server} ${volume}
  91. Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key1 /opt/hadoop/NOTICE.txt
  92. Execute rm -f NOTICE.txt.1
  93. Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1 NOTICE.txt.1
  94. Execute ls -l NOTICE.txt.1
  95. ${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.keyName=="key1")'
  96. Should contain ${result} createdOn
  97. ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.keyName=="key1") | .keyName'
  98. Should Be Equal ${result} key1
  99. Execute ozone sh key rename ${protocol}${server}/${volume}/bb1 key1 key2
  100. ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[].keyName'
  101. Should Be Equal ${result} key2
  102. Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key2
  103. Test key Acls
  104. [arguments] ${protocol} ${server} ${volume}
  105. Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key2 /opt/hadoop/NOTICE.txt
  106. ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2
  107. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" .
  108. ${result} = Execute ozone sh key addacl ${protocol}${server}/${volume}/bb1/key2 -a user:superuser1:rwxy
  109. ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2
  110. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
  111. ${result} = Execute ozone sh key removeacl ${protocol}${server}/${volume}/bb1/key2 -a user:superuser1:xy
  112. ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2
  113. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\"
  114. ${result} = Execute ozone sh key setacl ${protocol}${server}/${volume}/bb1/key2 -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc
  115. ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2
  116. Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\"
  117. Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" .