You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.sh 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/bash
  2. # This is an extremely simplistic test harness for the vacation functionality.
  3. # To judge success or failure you (unfortunately) need to tail -f the log file, which sucks a little,
  4. # but hey - it's better than no tests, right?
  5. # Original author: David Goodwin (hence all the palepurple.co.uk references!)
  6. # It would be nice if we could get some sort of status back from the vacation.pl script to indicate mail being sent, or not.
  7. export PGPASSWORD=gingerdog
  8. export PGUSER=dg
  9. export PGDATABASE=postfix
  10. export PGHOST=pgsqlserver
  11. echo "DELETE FROM vacation WHERE email = 'david@example.org'" | psql
  12. # First time around, there should be no vacation record for david@example.org, so these should all not cause mail to be sent.
  13. # some will trip up spam/mailing list protection etc though
  14. echo
  15. echo "NONE OF THESE SHOULD RESULT IN MAIL BEING SENT"
  16. echo
  17. #echo "On: mailing-list.txt:"
  18. # cat mailing-list.txt | perl ../vacation.pl -t yes -f fw-general-return-20540-david=example.org@lists.zend.com -- david\#example.org@autoreply.example.org
  19. echo "On: test-email.txt:"
  20. cat test-email.txt | perl ../vacation.pl -t yes -f david1@example.org -- david\#example.org@autoreply.example.org
  21. echo "On: spam.txt:"
  22. cat spam.txt | perl ../vacation.pl -t yes -f mary@ccr.org -- david\#example.org@autoreply.example.org
  23. echo "On: asterisk-email.txt:"
  24. cat asterisk-email.txt | perl ../vacation.pl -t yes -f www-data@palepurple.net -- david\#example.org@autoreply.example.org
  25. # do not reply to facebook
  26. echo "On: facebook.txt:"
  27. cat facebook.txt | perl ../vacation.pl -t yes -f notification+meynbxsa@facebookmail.com -- david\#example.org@autoreply.example.org
  28. # do not send yourself a vacation notice.
  29. echo "On: mail-myself.txt:"
  30. cat mail-myself.txt | perl ../vacation.pl -t yes -f david@example.org -- david\#example.org@autoreply.example.org
  31. # do not send yourself a vacation notice.
  32. echo "On: teodor-smtp-envelope-headers.txt:"
  33. cat teodor-smtp-envelope-headers.txt | perl ../vacation.pl -t yes -f david@example.org -- david\#example.org@autoreply.example.org
  34. echo "INSERT INTO vacation (email, subject, body, created, active, domain) VALUES ('david@example.org', 'I am on holiday', 'Yeah, that is right', NOW(), true, 'example.org')" | psql
  35. echo
  36. echo "VACATION TURNED ON "
  37. echo
  38. echo "Still ignore mailing list"
  39. cat mailing-list.txt | perl ../vacation.pl -t yes -f fw-general-return-20540-david=example.org@lists.zend.com -- david\#example.org@autoreply.example.org
  40. echo " * Should send vacation message for this *"
  41. cat test-email.txt | perl ../vacation.pl -t yes -f david1@example.org -- david\#example.org@autoreply.example.org
  42. echo " * Spam - no vacation message for this"
  43. cat spam.txt | perl ../vacation.pl -t yes -f mary@xxccr.org -- david\#example.org@autoreply.example.org
  44. echo " * OK - should send vacation message for this"
  45. cat asterisk-email.txt | perl ../vacation.pl -t yes -f www-data@palepurple.net -- david\#example.org@autoreply.example.org
  46. echo " * Facebook - should not send vacation message for"
  47. cat facebook.txt | perl ../vacation.pl -t yes -f notification+meynbxsa@facebookmail.com -- david\#example.org@autoreply.example.org
  48. echo " * Mailing myself - should not send vacation message"
  49. cat mail-myself.txt | perl ../vacation.pl -t yes -f david@example.org -- david\#example.org@autoreply.example.org
  50. echo