hadoop_stop_secure_daemon.bats 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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_stop_secure_daemon" {
  17. old_daemon_pid=12345
  18. old_priv_pid=23456
  19. new_daemon_pid=54321
  20. new_priv_pid=65432
  21. HADOOP_STOP_TIMEOUT=3
  22. echo ${old_daemon_pid} > daemonpidfile
  23. echo ${old_priv_pid} > privpidfile
  24. run hadoop_stop_secure_daemon stop daemonpidfile privpidfile &
  25. sleep 1
  26. echo ${new_daemon_pid} > daemonpidfile
  27. echo ${new_priv_pid} > privpidfile
  28. sleep ${HADOOP_STOP_TIMEOUT}
  29. [ -f daemonpidfile ]
  30. [ "$(cat daemonpidfile)" = "${new_daemon_pid}" ]
  31. [ -f privpidfile ]
  32. [ "$(cat privpidfile)" = "${new_priv_pid}" ]
  33. }