Skip to content

Instantly share code, notes, and snippets.

@nilsmagnus
Last active February 23, 2017 12:16
Show Gist options
  • Save nilsmagnus/8d5a431f19760ddcaa5d8c12d22b13f9 to your computer and use it in GitHub Desktop.
Save nilsmagnus/8d5a431f19760ddcaa5d8c12d22b13f9 to your computer and use it in GitHub Desktop.
Script that runs go test forever and gives a notification each time tests are broken or fixed.
#!/bin/bash
failing=0
while :
do
go test > /dev/null
if [ "$?" = "1" ]; then
if [ "$failing" = "1" ]; then
echo "Continuing failure!"
else
failing=1
echo "tests failed"
notify-send "go tests failed" -t 1500
fi
go test
else
if [ "$failing" = "1" ]; then
notify-send "go tests fixed" -t 1500
echo "Tests fixed."
fi
failing=0
fi
sleep 1
done
@nilsmagnus
Copy link
Author

Running the script

Download the script:

   wget https://gist.githubusercontent.com/nilsmagnus/8d5a431f19760ddcaa5d8c12d22b13f9/raw/c16fba1f9be83c395a3e4e493c72df8c715fe896/continous_gotest_notify.sh 

Execute it and let it run forever:

   sh continous_gotest_notify.sh

Exit the script by pressing ctrl-c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment