test_tailscaled.sh 636 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env bash
  2. #
  3. # This is a fake tailscale daemon 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. trap 'rm -f "$socket"' EXIT
  32. while sleep 10; do :; done