test_tailscaled.sh 607 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env bash
  2. #
  3. # This is a fake tailscale CLI that records its arguments, symlinks a
  4. # fake LocalAPI socket into place, and does nothing until terminated.
  5. #
  6. # It is used by main_test.go to test the behavior of containerboot.
  7. set -eu
  8. echo $0 $@ >>$TS_TEST_RECORD_ARGS
  9. socket=""
  10. while [[ $# -gt 0 ]]; do
  11. case $1 in
  12. --socket=*)
  13. socket="${1#--socket=}"
  14. shift
  15. ;;
  16. --socket)
  17. shift
  18. socket="$1"
  19. shift
  20. ;;
  21. *)
  22. shift
  23. ;;
  24. esac
  25. done
  26. if [[ -z "$socket" ]]; then
  27. echo "didn't find socket path in args"
  28. exit 1
  29. fi
  30. ln -s "$TS_TEST_SOCKET" "$socket"
  31. while true; do sleep 1; done