ozone-shell.robot 5.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. RestClient without http port
  23. Test ozone shell http:// ozoneManager restwoport
  24. RestClient with http port
  25. Test ozone shell http:// ozoneManager:9874 restwport
  26. RestClient without host name
  27. Test ozone shell http:// ${EMPTY} restwohost
  28. RpcClient with port
  29. Test ozone shell o3:// ozoneManager:9862 rpcwoport
  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} --user bilbo --quota 100TB --root
  38. Should not contain ${result} Failed
  39. Should contain ${result} Creating Volume: ${volume}
  40. ${result} = Execute ozone sh volume list ${protocol}${server}/ --user bilbo | 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 --user bilbo | grep -Ev 'Removed|DEBUG|ERROR|INFO|TRACE|WARN' | jq -r '.[] | select(.volumeName=="${volume}")'
  43. Should contain ${result} createdOn
  44. Execute ozone sh volume update ${protocol}${server}/${volume} --user bill --quota 10TB
  45. ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .owner | .name'
  46. Should Be Equal ${result} bill
  47. ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.volumeName=="${volume}") | .quota | .size'
  48. Should Be Equal ${result} 10
  49. Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1
  50. ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .storageType'
  51. Should Be Equal ${result} DISK
  52. ${result} = Execute ozone sh bucket update ${protocol}${server}/${volume}/bb1 --addAcl user:frodo:rw,group:samwise:r | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .acls | .[] | select(.name=="samwise") | .type'
  53. Should Be Equal ${result} GROUP
  54. ${result} = Execute ozone sh bucket update ${protocol}${server}/${volume}/bb1 --removeAcl group:samwise:r | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.bucketName=="bb1") | .acls | .[] | select(.name=="frodo") | .type'
  55. Should Be Equal ${result} USER
  56. ${result} = Execute ozone sh bucket list ${protocol}${server}/${volume}/ | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.bucketName=="bb1") | .volumeName'
  57. Should Be Equal ${result} ${volume}
  58. Run Keyword Test key handling ${protocol} ${server} ${volume}
  59. Execute ozone sh bucket delete ${protocol}${server}/${volume}/bb1
  60. Execute ozone sh volume delete ${protocol}${server}/${volume} --user bilbo
  61. Test key handling
  62. [arguments] ${protocol} ${server} ${volume}
  63. Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key1 /opt/hadoop/NOTICE.txt
  64. Execute rm -f NOTICE.txt.1
  65. Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1 NOTICE.txt.1
  66. Execute ls -l NOTICE.txt.1
  67. ${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '. | select(.keyName=="key1")'
  68. Should contain ${result} createdOn
  69. ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[] | select(.keyName=="key1") | .keyName'
  70. Should Be Equal ${result} key1
  71. Execute ozone sh key rename ${protocol}${server}/${volume}/bb1 key1 key2
  72. ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | grep -Ev 'Removed|WARN|DEBUG|ERROR|INFO|TRACE' | jq -r '.[].keyName'
  73. Should Be Equal ${result} key2
  74. Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key2