tests.sh 495 B

123456789101112131415
  1. #!/bin/sh
  2. while ! timeout 1 bash -c "echo > /dev/tcp/voting-app/80"; do sleep 1; done
  3. curl -sS -X POST --data "vote=a" http://voting-app > /dev/null
  4. curl -sS -X POST --data "vote=b" http://voting-app > /dev/null
  5. sleep 10
  6. if phantomjs render.js http://result-app | grep -q '2 votes'; then
  7. echo -e "\e[42m------------"
  8. echo -e "\e[92mTests passed"
  9. echo -e "\e[42m------------"
  10. exit 0
  11. fi
  12. echo -e "\e[41m------------"
  13. echo -e "\e[91mTests failed"
  14. echo -e "\e[41m------------"
  15. exit 1