hadoop_verify_user.bats 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. load hadoop-functions_test_helper
  16. @test "hadoop_verify_user (hadoop: no setting)" {
  17. run hadoop_verify_user hadoop test
  18. [ "${status}" = "0" ]
  19. }
  20. @test "hadoop_verify_user (yarn: no setting)" {
  21. run hadoop_verify_user yarn test
  22. [ "${status}" = "0" ]
  23. }
  24. @test "hadoop_verify_user (hadoop: allow)" {
  25. HADOOP_TEST_USER=${USER}
  26. run hadoop_verify_user hadoop test
  27. [ "${status}" = "0" ]
  28. }
  29. @test "hadoop_verify_user (yarn: allow)" {
  30. YARN_TEST_USER=${USER}
  31. run hadoop_verify_user yarn test
  32. [ "${status}" = "0" ]
  33. }
  34. # colon isn't a valid username, so let's use it
  35. # this should fail regardless of who the user is
  36. # that is running the test code
  37. @test "hadoop_verify_user (hadoop: disallow)" {
  38. HADOOP_TEST_USER=:
  39. run hadoop_verify_user hadoop test
  40. [ "${status}" = "1" ]
  41. }
  42. @test "hadoop_verify_user (yarn: disallow)" {
  43. YARN_TEST_USER=:
  44. run hadoop_verify_user yarn test
  45. [ "${status}" = "1" ]
  46. }