420_host_control_test.sh 624 B

1234567891011121314151617181920
  1. #! /bin/bash
  2. # shellcheck disable=SC1091
  3. . ./config.sh
  4. start_suite "Test host controls"
  5. weave_on "$HOST1" launch
  6. scope_on "$HOST1" launch
  7. sleep 10
  8. PROBEID=$(docker_on "$HOST1" logs weavescope 2>&1 | grep "probe starting" | sed -n 's/^.*ID \([0-9a-f]*\)$/\1/p')
  9. HOSTID=$($SSH "$HOST1" hostname)
  10. # Execute 'echo foo' in the host tty and check its output
  11. PIPEID=$(curl -s -f -X POST "http://$HOST1:4040/api/control/$PROBEID/$HOSTID;<host>/host_exec" | jq -r '.pipe')
  12. assert "(sleep 1 && echo \"PS1=''; echo foo\" && sleep 1) | wscat -b 'ws://$HOST1:4040/api/pipe/$PIPEID' | col -pb | tail -n 1" "foo\\n"
  13. scope_end_suite