Last active
June 23, 2021 18:24
-
-
Save markedmondson/a8eebecfb5d042b214ceaf6b16806fed to your computer and use it in GitHub Desktop.
Run 25 random test files 50 times before your known test file (with randomized time). Once you get a solid failing $TEST_FILES keep going!
This file contains hidden or 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 | |
# Requires sudo apt-get install libfaketime | |
# Run with bash ./scraps/random_tests.sh | |
# You may or may not need these... | |
# export DYLD_FORCE_FLAT_NAMESPACE=1 | |
# export DYLD_INSERT_LIBRARIES=/path/to/libfaketime.1.dylib | |
for i in {1..50} | |
do | |
HOUR=$( shuf -i 1-23 -n 1 ) | |
FAKETIMEX=\"-$(echo $HOUR)h\" | |
# echo $FAKETIMEX | |
# echo "Run $i; faketime -f ${FAKETIMEX} rails test" | |
TEST_FILES="$(find test -type f -name "*_test.rb" -not -path "*/system/*" | shuf -n 25 | tr '\n' ' ') test/controllers/some_intermittent_failing_test.rb" | |
echo "Run $i; faketime -f ${FAKETIMEX} rails test $TEST_FILES" | |
echo $TEST_FILES | |
# faketime -f ${FAKETIMEX} rails test $TEST_FILES | |
faketime -f "-$(echo $i)h x10" rails test --seed 44001 $TEST_FILES | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment