/tests/t0005-rcmd_type-and-user.sh

https://code.google.com/ · Shell · 25 lines · 21 code · 3 blank · 1 comment · 0 complexity · a9d0fc4bdc75b8bf8a025f578cf521aa MD5 · raw file

  1. #!/bin/sh
  2. test_description='pdsh rcmd_type and remote user handling'
  3. . ${srcdir:-.}/test-lib.sh
  4. test_expect_success 'pdsh -l sets username for all hosts' '
  5. pdsh -S -Rexec -lbar -w foo[1-100] test "%u" = bar
  6. '
  7. test_expect_success 'Can set remote username via user@hosts' '
  8. pdsh -S -Rexec -w bar@foo[1-100] test "%u" = bar
  9. '
  10. test_expect_success 'user@hosts works for a subset of hosts' '
  11. pdsh -S -Rexec -w u1@foo,u2@bar sh -c \
  12. "if test %h = foo; then test %u = u1; else test %u = u2; fi"
  13. '
  14. test_expect_success 'Can set rcmd_type via rcmd_type:hosts' '
  15. PDSH_RCMD_TYPE=ssh
  16. pdsh -S -w exec:foo[1-10] true
  17. '
  18. test_expect_success 'Can set rcmd_type and user via rcmd_type:user@hosts' '
  19. PDSH_RCMD_TYPE=ssh
  20. pdsh -S -w exec:bar@foo[1-10] test "%u" = bar
  21. '
  22. test_done