Skip to content

Commit

Permalink
tests script: perform cleanup
Browse files Browse the repository at this point in the history
clean up content on each fresh test run instance
  • Loading branch information
fallwith committed Oct 8, 2024
1 parent ffea529 commit a1ad06e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/script/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ help() {
echo " "
}


unit_command() {
# echo "ENV TEST="$TEST" TESTOPTS="$TESTOPTS""
# echo "bundle exec rake test -q;"
Expand All @@ -78,6 +77,8 @@ set_test_opts() {

# organizes the args for mutiverse and calls the command
run_multiverse() {
clean

if [[ -n "$3" ]]; then
# echo "running file and name"
multiverse_command "$1",file="$2",name="$3";
Expand All @@ -95,6 +96,8 @@ run_multiverse() {

# calls multiverse but only env 0 or specified and method prepend
run_multiverse_quick() {
clean

if [[ "$2" =~ [0-9]+ && ! "$2" =~ ^test ]]; then
run_multiverse "$1",env="$2",method=prepend "$3" "$4"
else
Expand All @@ -104,6 +107,8 @@ run_multiverse_quick() {

# organizes the args for env tests and calls the command
run_env_tests() {
clean

# this will add "rails" before any number so you can pass in just "61" or "61,70"
ENVARGS=$(echo "$1" | sed -E -e 's/(\,)|(\,rails)/,rails/g' | sed '/^rails/!s/^/rails/');

Expand All @@ -126,6 +131,8 @@ run_env_tests() {

# organizes the args for the unit tests and calls the command
run_unit_tests() {
clean

find_test_file "$1" "new_relic"
if [[ -n "$2" ]]; then
# echo "running file and name"
Expand All @@ -144,6 +151,15 @@ run_unit_tests() {
fi
}

clean() {
echo 'Cleaning...'
# xargs over -exec to avoid warnings on already-deleted content
find . -name \*.log | xargs rm -f
find . -name tmp -type d | xargs rm -rf
rm -rf lib/coverage test/minitest/minitest_time_report test/multiverse/lib/multiverse/errors.txt
echo 'Done.'
}

# from a given space/newline delimited string of file paths, return the
# shortest path
#
Expand Down

0 comments on commit a1ad06e

Please sign in to comment.