Created
November 24, 2023 09:23
-
-
Save qgadrian/b01d5038ea0daee75d3ce5d0baac7d05 to your computer and use it in GitHub Desktop.
Run Elixir mix tests several times to check which of them are failing randomly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Define the maximum number of test executions | |
MAX_EXECUTIONS=100 | |
# Initialize a counter for test executions | |
executions=0 | |
# Run the tests until one of them fails or the limit is reached | |
while [ $executions -lt $MAX_EXECUTIONS ]; do | |
mix test | |
# Check the exit status of the last command (mix test) | |
if [ $? -ne 0 ]; then | |
echo "A test has failed!" | |
exit 1 | |
fi | |
# Increment the execution counter | |
executions=$((executions + 1)) | |
done | |
# If the loop completes without a failure, print a message | |
echo "All tests passed $executions times." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment