commonlib.robot 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. Library OperatingSystem
  17. Library String
  18. Library BuiltIn
  19. *** Variables ***
  20. ${SECURITY_ENABLED} %{SECURITY_ENABLED}
  21. *** Keywords ***
  22. Execute
  23. [arguments] ${command}
  24. ${rc} ${output} = Run And Return Rc And Output ${command}
  25. Log ${output}
  26. Should Be Equal As Integers ${rc} 0
  27. [return] ${output}
  28. Execute And Ignore Error
  29. [arguments] ${command}
  30. ${rc} ${output} = Run And Return Rc And Output ${command}
  31. Log ${output}
  32. [return] ${output}
  33. Execute and checkrc
  34. [arguments] ${command} ${expected_error_code}
  35. ${rc} ${output} = Run And Return Rc And Output ${command}
  36. Log ${output}
  37. Should Be Equal As Integers ${rc} ${expected_error_code}
  38. [return] ${output}
  39. Compare files
  40. [arguments] ${file1} ${file2}
  41. ${checksumbefore} = Execute md5sum ${file1} | awk '{print $1}'
  42. ${checksumafter} = Execute md5sum ${file2} | awk '{print $1}'
  43. Should Be Equal ${checksumbefore} ${checksumafter}
  44. Install aws cli
  45. ${rc} ${output} = Run And Return Rc And Output which apt-get
  46. Run Keyword if '${rc}' == '0' Install aws cli s3 debian
  47. ${rc} ${output} = Run And Return Rc And Output yum --help
  48. Run Keyword if '${rc}' == '0' Install aws cli s3 centos
  49. Kinit test user
  50. ${hostname} = Execute hostname
  51. Set Suite Variable ${TEST_USER} testuser/${hostname}@EXAMPLE.COM
  52. Wait Until Keyword Succeeds 2min 10sec Execute kinit -k ${TEST_USER} -t /etc/security/keytabs/testuser.keytab