connect.bats 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env -S bats
  2. @test "run connect ping web30.intr" {
  3. run timeout 3 bin/executable_connect ping web30.intr
  4. [ "$status" -eq 0 ]
  5. [[ "$output" == *64\ bytes* ]]
  6. }
  7. @test "run connect containers web30.intr" {
  8. run timeout 3 bin/executable_connect containers web30.intr
  9. [ "$status" -eq 0 ]
  10. [[ "$output" == *nginx* ]]
  11. }
  12. @test "run connect ssh web30.intr" {
  13. run timeout 3 bin/executable_connect ssh web30.intr
  14. [ "$status" -eq 124 ]
  15. [[ "$output" == *root@web30* ]]
  16. }
  17. @test "run connect ip-filter --host=web30.intr --describe" {
  18. run timeout 3 bin/executable_connect ip-filter --host=web30.intr --describe
  19. [ "$status" -eq 0 ]
  20. [[ "$output" == *blocked* ]]
  21. }
  22. @test "run connect shell sw1-mr11.intr show interfaces" {
  23. run timeout 3 bin/executable_connect shell sw1-mr11.intr show interfaces
  24. [ "$status" -eq 0 ]
  25. [[ "$output" == *FastEthernet* ]]
  26. }
  27. @test "run connect br1-mr14.intr -- id" {
  28. run timeout 3 bin/executable_connect br1-mr14.intr -- id
  29. [ "$status" -eq 0 ]
  30. [[ "$output" == *"uid=0(root)"* ]]
  31. }
  32. # XXX: Test exit code
  33. @test "run SSHRC_BECOME=yes connect sshrc web30.intr -- id" {
  34. run env SSHRC_BECOME=yes timeout 3 bin/executable_connect sshrc web30.intr -- id
  35. [[ "$output" == *"uid=0(root)"* ]]
  36. }
  37. # XXX: Test exit code
  38. @test "run SSHRC_BECOME=yes connect sshrc jenkins.intr -- id" {
  39. run env SSHRC_BECOME=yes timeout 3 bin/executable_connect sshrc jenkins.intr -- id
  40. [[ "$output" == *"uid=0(root)"* ]]
  41. }